2 Checker for NEERC'2009 Problem G: Garbling Game
\r
15 Output = array of integer;
\r
17 function NextOutput(var strm: InStream): Output;
\r
19 SetLength(Result, 0);
\r
20 while not strm.SeekEof do begin
\r
21 SetLength(Result, Length(Result) + 1);
\r
22 Result[Length(Result) - 1] := strm.ReadInteger();
\r
31 ja := NextOutput(ans);
\r
32 pa := NextOutput(ouf);
\r
34 if not ouf.SeekEof then
\r
35 Quit(_PE, 'Extra data in output');
\r
37 if Length(pa) <> Length(ja) then
\r
38 Quit(_WA, Format('%d numbers instead of %d', [Length(pa), Length(ja)]));
\r
40 for i := 1 to Length(pa) do
\r
41 if pa[i - 1] <> ja[i - 1] then
\r
42 Quit(_WA, Format('%d instead of %d on line %d', [pa[i - 1], ja[i - 1], i]));
\r
44 Quit(_OK, Format('%d numbers', [Length(pa)]));
\r