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

奇怪,全部换成长整就过了。

Posted by kzy at 2010-06-28 16:45:17 on Problem 1860
program ex;
var
  a,b:array[1..100,1..100] of real;
  c:array[1..100,1..100] of longint;
  aa:array[1..100] of longint;
  d:array[1..100] of real;
  f:array[1..100] of boolean;
  level:array[1..100] of longint;
  q:array[1..10001] of longint;
  n,m,v:longint;
  r1,r2,c1,c2,t,s:real;
  i,t1,t2,l,r:longint;
begin
  fillchar(level,sizeof(level),0);
  fillchar(f,sizeof(f),0);
  readln(n,m,v,s);
  for i:=1 to n do aa[i]:=0;
  for i:=1 to m do
   begin
     readln(t1,t2,r1,c1,r2,c2);
     inc(aa[t1]);
     a[t1,aa[t1]]:=r1;
     b[t1,aa[t1]]:=c1;
     c[t1,aa[t1]]:=t2;
     inc(aa[t2]);
     a[t2,aa[t2]]:=r2;
     b[t2,aa[t2]]:=c2;
     c[t2,aa[t2]]:=t1;
   end;
  for i:=1 to n do d[i]:=-10000000;
  d[v]:=s;
  l:=0;
  r:=1;
  q[1]:=v;
  f[v]:=true;
  level[v]:=1;
  while l<r do
   begin
     inc(l);
     t1:=q[l];
     f[t1]:=false;
     for i:=1 to aa[t1] do
       begin
         t2:=c[t1,i];
         t:=(d[t1]-b[t1,i])*a[t1,i];
         if t<0 then continue;
         if t>d[t2] then
          begin
            d[t2]:=t;
            if not f[t2] then
             begin
               inc(r);
               q[r]:=t2;
               f[t2]:=true;
               level[t2]:=level[t1]+1;
               if level[t2]>n then
                begin
                  writeln('YES');
                  exit;
                end;
             end;
          end;
       end;
  end;
  writeln('NO');
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