Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

Same code, WA on test #1 using GNU C11, AC with GNU C++17. Why?

Revision en3, by NaimSS, 2023-06-30 18:35:42

Last week we had a local Contest available here (statements only in portuguese), and I was surprised when the easiest problem was getting a lot of Wrong Answers on test 1. All of them seemed correct, gave the correct output locally and were using GNU C11. For some reason, re-submitting the same code in GNU C++ gave AC. Why?

Problem Statement

Given the formula of gravitational attraction $$$F = \frac{G\cdot M_1 \cdot M_ 2}{d^2}$$$, find the value of $$$G$$$ given the mass of the 2 objects, the force and their positions on space (which is only a line).

The code

WA on 1

AC

After seeing this, I made an announcement for people to submit their problem using GNU C++ and a ton of AC came in... as a setter I was frustrated by such a bug and want to know why that happened :(

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English NaimSS 2023-06-30 18:37:15 0 Tiny change: 'al Contest available' -> 'al Contest, Maratona Femin available' (published)
en3 English NaimSS 2023-06-30 18:35:42 2 Tiny change: 'Given the Formula of ' -> 'Given the formula of '
en2 English NaimSS 2023-06-30 18:33:51 207
en1 English NaimSS 2023-06-30 18:32:00 971 Initial revision (saved to drafts)