Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么我自己用waterloo的数据测是对的,交上来是runtime error

Posted by dinosaur at 2006-11-04 13:21:49 on Problem 1909
var
  n,i,j,ans,num,f,t,v:longint;
  m,d,father,dui:array [1..10000] of longint;
procedure main;
  begin
    while t<f do
      begin
        t:=t+1;
        m[father[dui[t]]]:=m[father[dui[t]]]+m[dui[t]]-1;
        d[father[dui[t]]]:=d[father[dui[t]]]-1;
        if d[father[dui[t]]]=0 then
        begin
        f:=f+1;
        dui[f]:=father[dui[t]];
        d[dui[f]]:=maxlongint;
        end;
        ans:=ans+abs(m[dui[t]]-1);
      end;
  end;
begin
  readln(n);
  while n<>0 do
    begin
      f:=0;t:=0;
      for i:=1 to n do
        begin
          read(num);
          read(m[num],d[num]);
          if d[num]=0 then
            begin
              f:=f+1;
              dui[f]:=num;
              d[num]:=maxlongint;
            end
          else
            for j:=1 to d[num] do
              begin
                read(v);
                father[v]:=i;
              end;
          readln;
        end;
      ans:=0;
      main;
      writeln(ans);
      readln(n);
    end;
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator