ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1375. Bill Clevers

WA#10 (without overflow). Help.
Posted by Alex Stoff 19 Sep 2005 00:31

For x:=0 to p-1 do
 For y:=0 to p-1 do
  Begin
 t1:=x*x; t2:=y*y;
If (t1+t2) mod p=k mod p then ...

Before, t1,t2:int64. There is no Overflow and no TLE.

Help, If you can.

Thanks a lot.
Re: WA#10 (without overflow). Help.
Posted by Anatoliy 'Tolyan_NO' Tolstobroff 19 Sep 2005 00:36

Send me you code maybe I help you.
    tolik-tol@inbox.ru
Re: WA#10 (without overflow). Help.
Posted by Anatoliy 'Tolyan_NO' Tolstobroff 19 Sep 2005 00:40
oh i find.

t1:=x*x   it is overflov
but
t1:=x;
t1:=t1*x;   not overflow.
or t1:=sqr(x)  too not overflow.
sqr=64bit  x*x=32bits
but i think you got TLE.
good luck.
Thanks!!
Posted by Alex Stoff 11 Oct 2005 23:04

Thanks a lot! I've got AC.
I'll take it in!