2 Checker for NEERC'2009 Problem I: Inspection
\r
18 i, j, k, n, x, kk: Integer;
\r
19 a, b: array[1..100, 1..100] of boolean;
\r
23 n := inf.readlongint;
\r
24 fillchar(a, sizeof(a), 0);
\r
25 fillchar(b, sizeof(b), 0);
\r
26 for i := 1 to n do begin
\r
27 k := inf.readlongint;
\r
28 for j := 1 to k do begin
\r
29 x := inf.readlongint;
\r
34 pa := ouf.readlongint;
\r
36 for i := 1 to pa do begin
\r
37 if (ouf.seekeoln) then Quit(_PE, Format('Empty line in output file: line %d', [i]));
\r
38 k := ouf.readlongint;
\r
39 if (k < 1) or (k > n) then Quit(_WA, Format('Node number %d is not in range', [k]));
\r
40 while not ouf.seekeoln do begin
\r
41 kk := ouf.readlongint;
\r
42 if (kk < 1) or (kk > n) then Quit(_WA, Format('Node number %d is not in range', [kk]));
\r
43 if not a[k][kk] then Quit(_WA, Format('There is no slope from %d to %d', [k, kk]));
\r
52 if a[i][j] and not b[i][j] then Quit(_WA, Format('Slope from %d to %d was not inspected', [i, j]));
\r
54 ja := ans.readlongint;
\r
56 Quit(_WA, Format('Not optimal solution: %d instead of %d', [pa, ja]));
\r
58 Quit(_FAIL, Format('Jury solution is not optimal : %d instead of %d', [pa, ja]));
\r
59 Quit(_OK, Format('%d paths', [pa]));
\r