ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1361. Космология против Хронологии

Int64 problems
Послано Janez Brank 4 окт 2005 04:27
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
Послано Vladimir Yakovlev (USU) 5 окт 2005 02:03
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
Послано Vladimir Yakovlev (USU) 4 янв 2006 03:47
This bug is fixed in FreePascal now.
Your submits with WA#1 were rejudged.