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 1211. Collective Guarantee

Correct idea is HERE
Posted by Vlad Veselov 6 Jun 2003 19:04
Use two arrays:
Ans,Status : Array [1 .. 25000] Of Word;
Ans is answers of children, Status is current status of every of them.
First Status = DUP(0), and then
 Status[i] = 0 - if child i have unknown status
             1 - if child's answer is "Me!!!"
             k - if we marked him(or her) on step k(k >= 2)
In every iteration we searching for child with unknown status(p).
If his(or her)answer is "Me" we making his(or her) status equal to
1, else we mark him(or her) with k and going to check child Ans[p].
If we meet status=k in our checking then cycle is found. Else we
continue this process until we can find child with status = 0.
Don't forget calculate children with status = 1.
My solution on Pascal got AC with 0.62 sec., 127K.
P.S. Sorry for bad English.
I just use 0.203s
Posted by hello 15 May 2004 23:08
After system upgrade it works 0.234 sec.
Posted by Vlad Veselov 16 May 2004 19:35
Re: Correct idea is HERE
Posted by Фоминых Федор 25 Jul 2005 14:02
/*AC*/
double time = 0.14;
long memory = 349; //КБ
return;

I am not use your idea!!!

No optimization!!!

Edited by author 25.07.2005 14:03

Edited by author 25.07.2005 14:04

Edited by author 25.07.2005 14:05
My more faste and memory LOW!!
Posted by Tolstobrov_Anatoliy[Ivanovo SPU] 29 Jul 2005 02:29

885512
02:26:18
29 июл 2005
Tolstobrov_Anatoliy[Ivanovo SPU]
1211
Pascal
Accepted

0.062
223 КБ


Who can better????
Oh foget!!
Posted by Tolstobrov_Anatoliy[Ivanovo SPU] 29 Jul 2005 02:36

I USE

const coll=25000;
var
m:array[0..coll]of word;
z,b:array[0..coll]of boolean;
t,i,k,j,n:word;
kk,gg,bb:boolean;