|
|
back to boardInt64 problems I tried to submit a Pascal solution using 64-bit integers and received wrong answer already on test #1. (The same solution with 32-bit integers received wrong answer only on test #55.) Anyway, after much experimentation, I noticed that if I change the signature of just one function (the solver for the Diophantine equation Ax + By = C) from function Diophant(A, B, C: int64; var x, y, dx, dy: int64): boolean; to function Diophant(A, B, C: integer; var x, y, dx, dy: int64): boolean; the program was accepted. I don't see why the two should produce different results, but the fact is that, on the evaluation server, they do, already on the first test case (I tried calling both and entering an endless loop if the results differ, and the program got TLE which means that the results really did differ). Of course the results of both versions were the same when I was testing on my own computer (with FreePascal -- I'm not sure which compiler is used on the evaluation server). I guess this must be due to some kind of quirk in the compiler used on the evaluation server. So if anybody else is having problems with 64-bit integers in Pascal for this task, maybe some similar workaround will work for you as well -- don't pass 64-bit integers as parameters unless really necessary. Re: Int64 problems It's a bug of FreePascal This program outputs 4294967295 on server. var x: integer; begin x := 1; writeln(int64(-x)); end. Try to avoid structures like int64(-x). I hope the bug will be fixed soon. Bug is fixed This bug is fixed in FreePascal now. Your submits with WA#1 were rejudged. |
|
|