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 1106. Two Teams

this my code...please help me... wa#23...
Posted by Crash_access_violation 17 Mar 2008 00:47
please gime some contrtests...

VAR
 ok : BooLean;
 N, M : integer;
 B : Array [1 .. 100] of integer;
 A : Array [1 .. 100, 1 .. 100] of integer;

PROCEDURE In_Data;
 Var
  i, W : integer;
   Begin
    ReadLn(N);
    ok := false;
     for i := 1 to N do
      begin
       Read(W);
        if W = 0 then
          begin
           ok := true;
           Exit;
          end;
       while W <> 0 do
        begin
         A[i, W] := 1;
         Read(W);
        end;
       ReadLn;
      end;
   End;

PROCEDURE Out_Data;
 Var
  i : integer;
   Begin
    WriteLn(M);
     for i := 1 to N do
      if B[i] = 1 then
        Write(i, ' ');
   End;

PROCEDURE Solve;
 Var
  i, j : integer;
   Begin
    for i := 1 to N do
     begin
      if B[i] = 0 then
        B[i] := 1;
      for j := 1 to N do
       if A[i, j] = 1 then
         begin
          if B[i] = 1 then
            B[j] := 2
              else
            B[j] := 1;
          A[i, j] := 0;
          A[j, i] := 0;
         end;
     end;
    M := 0;
    for i := 1 to N do
     if B[i] = 1 then
       inc(M);
   End;

PROCEDURE Run;
   Begin
    In_Data;
     if ok then
       begin
        WriteLn(0);
        Exit;
       end;
     Solve;
     Out_Data;
   End;

BEGIN
 Run;
END.