|
|
вернуться в форумPlease help. My program fails test validation at test #3. 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 (+) 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 (+) 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) (+) 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. |
|
|