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 1156. Two Rounds

Help me ! Compilation Error! tell me why
Posted by miaochen 23 Apr 2004 14:40
program p1156;

type  re=record
          t:integer;
          s:set of byte;
        end;
var a:array[1..100,0..1]of re;
    b:array[1..100]of byte;
    xs:array[1..100]of set of byte;
    m,n,i,j,k,x,y,t:integer;
    s:set of byte;
    f:boolean;

procedure inpu;
var i:integer;
begin
  readln(n,m);
  for i:=1 to m do begin
    readln(x,y);
    xs[x]:=xs[x]+[y];
    xs[y]:=xs[y]+[x];
  end;
end;

procedure pret;
var i,j:integer;
    f:boolean;
begin
  k:=0;
  s:=[1..2*n];
  while s<>[] do begin
    inc(k);
    for i:=1 to 2*n do
      if i in s then break;
    inc(a[k,0].t);
    a[k,0].s:=a[k,0].s+[i];
    s:=s-[i];
    f:=true;
    j:=0;
    while f do begin
      j:=1-j;
      f:=false;
      for i:=1 to 2*n do
        if i in s then
          if xs[i]*a[k,1-j].s<>[] then begin
            inc(a[k,j].t);
            a[k,j].s:=a[k,j].s+[i];
            s:=s-[i];
            f:=true;
          end;
    end;
  end;
end;

procedure outpu;
var i:integer;
begin
  for i:=1 to 2*n do
    if i in s then write(i,' ');
  writeln;
  for i:=1 to 2*n do
    if not(i in s) then write(i,' ');
  writeln;
  halt;
end;

procedure try(i:integer);
var j:integer;
begin
  for j:=0 to 1 do begin
    inc(t,a[i,j].t);
    s:=s+a[i,j].s;
    b[i]:=j;
    if i<k then begin
      if t<n then try(i+1)
    end
    else
      if t=n then outpu;
    s:=s-a[i,j].s;
    dec(t,a[i,j].t);
  end;
end;

begin
  inpu;
  pret;
  t:=0;
  try(1);
  writeln('IMPOSSIBLE');
end.
You can't use "try" in your code..change "try" to other words.
Posted by tbtbtb 26 Apr 2004 17:42