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

Michael Rybak (accepted@ukr.net) Please help. My program fails test validation at test #3. [3] // Problem 1099. Work Scheduling 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.
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.
Vladimir Yakovlev (USU) see in (+) [1] // Problem 1099. Work Scheduling 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.
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.