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 1218. Episode N-th: The Jedi Tournament

Compilation Error! Why???
Posted by Michael Medvedev 26 Jun 2004 23:34
program p1218;
const mx = 500;
var
 on,tw,th,good:array[1..mx] of longint;
 s:array[1..mx] of string;
 v:array[1..mx,1..mx] of boolean;
 n,k,i,j:integer;
 c:char;

function win(i,j:integer):boolean;
var
  res:integer;
begin
  res := byte(on[i] > on[j]) + byte(tw[i] > tw[j]) + byte(th[i] > th[j]);
  if res > 1 then win := True else win := False;
end;

function fill(j:integer):boolean;
var
  i:integer;
  b:boolean;
begin
  b := True;
  for i:=1 to n do
    b := b and v[j,i];
  if b then fill := True else fill := False;
end;

begin
  readln(n);
  for i:=1 to n do
  begin
   read(c); s[i]:='';
   repeat
    s[i] := s[i] + c;
    read(c);
   until c = ' ';
   readln(on[i],tw[i],th[i]);
  end;

  for i:=1 to n do
  for j:=1 to n do
    v[i,j] := win(i,j);

  for k:=1 to n do
    for i:=1 to n do
      for j:=1 to n do
       if not v[i,j] then v[i,j] := v[i,k] and v[k,j];

  for i:=1 to n do
   if fill(i) then writeln(s[i]);
end.
Re: Compilation Error! Why???
Posted by Vladimir Yakovlev (USU) 26 Jun 2004 23:49
'on' is a reserved keyword.