Pascal adding results don't match on judging server and my computer

Revision en1, by Brackets12, 2025-02-28 01:30:59

So today I was trying this question: 1971F - Circle Perimeter

I saw that I did not pass test 6, so I tried fixing it. Then I figured I can get some help by looking at the test case.

The test case turns out to be simple: 1 100000

So I tested the case on my computer. To my surprise it worked out. The answer was correct!! But the judging server got wrong answer! Now I was raging because I can't get it to pass on the judge so I wrote the same thing in C++. And again surprised me because it actually passed. Now these two are literally the same thing written in two different languages, but why does one work and the other one not? C++: 308206113 PASCAL: 308204979

I did some extra tests. Apparently the sums on my computer and on the judging server don't match. I made a sum that adds up all (mid * mid + x * x). My computer gave me this: 285138544 (which is correct because I verified it with the C++ program that passed), the judge gave me this: -1325314186. (negative probably because of overflow, but if they are the same sum, even the overflowed answer should be the same..) There were no overflows in the process. I tested it by this submission: 308205548 You can see in this submission that the sum was negative: 308205808

So I was wondering how you can have two different results there. It's really weird because addition cannot have two answers...

Is there a problem with the flags the judging servers for pascal is using? Or is it a problem with the PASCAL language? (I don't think it's my problem because my local code's sum matched up with the submission that passed..)

Tags free pascal, pascal, compilers, error, c++, plus, 64-bits integers, geometry

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Brackets12 2025-02-28 01:31:22 0 (published)
en1 English Brackets12 2025-02-28 01:30:59 1672 Initial revision (saved to drafts)