Блог пользователя Brackets12

Автор Brackets12, история, 12 часов назад, По-английски

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..)

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
12 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Brackets12 (previous revision, new revision, compare).

»
11 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How I ran the pascal code : fpc (_.pas) && ./(_)

btw if you have a free pascal compiler feel free to go into my submissions, copy my code and run it yourself. I don't know if it's only my compiler that's doing it (Using a mac M2 fpc 3.2.2)