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 1099. Work Scheduling

Please help. My program fails test validation at test #3.
Posted by Michael Rybak (accepted@ukr.net) 1 Oct 2004 23:49
There's already such information posted here by RightAnswer in 2001, which says, that there are 2 equal numbers in a line in test data.
 As for me, I have a procedure in my program, called DoCrash, which consist of a single Halt operator. The only place where I call it in the program is right after Readln(i,j) when reading another line of input data. I have such a line right after this:
 If i=j Then DoCrash;

My program gets WA on test 3. If I try changing consitance of DoCrash procedure to "While True Do", I get  TL. This should mean that there ARE 2 equal numbers in some line, as far as I understand, shouldn't it? Please help me with my confusion.
I shall answer my question myself, since this could be helpful to people having problems with test 3 (+)
Posted by Michael Rybak (accepted@ukr.net) 2 Oct 2004 17:13
There actually IS a line (i,j) in input data, where i=j, although it contradicts the problem statement ("no guard can walk alone"). You should ignore it, and process the rest of the test normally.
see in (+)
Posted by Vladimir Yakovlev (USU) 3 Oct 2004 01:13
You're right - there tests with i=j in it.
I think this is not so big problem, because typical solution read pairs in such way:
while (scanf("%d %d", &x, &y) != EOF)
adj[x][y] = adj[y][x] = 1;
Nevertheless, I cut all pairs of equal numbers from tests. You may not worry about correctness of tests now.
Thank you. Although (i,i) pairs shouldn't be a problem, sometimes it is (like in my case) (+)
Posted by Michael Rybak (accepted@ukr.net) 3 Oct 2004 05:42
Particularly, my input was like this:
readln(x,y);
if a[x,y]=1 then continue;
a[x,y]:=1;
inc(ne[x]);// number of going from x
e[x,ne[x]]:=y;// e[x,..] - list of edges from x
inc(ne[y]);
e[y,ne[y]]:=x;

so you see, that (i,i) pairs do cause problems in my case, because I treat them as possible edges to go through.
 Anyway, thank you for making the test correct.