Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses math;
- var x,y,n,m,i,ans:longint;
- dp:array[1..1000000]of longint;
- f:text;
- begin
- assign(f,'longpath.in');
- reset(f);
- read(f,n,m);
- for i:=1 to m do
- begin
- read(f,x,y);
- dp[y]:=max(dp[y],dp[x]+1);
- if dp[y]>ans
- then ans:=dp[y];
- end;
- close(f);
- assign(f,'longpath.out');
- rewrite(f);
- writeln(f,ans);
- close(f);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement