Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. uses math;
  2. var x,y,n,m,i,ans:longint;
  3. dp:array[1..1000000]of longint;
  4. f:text;
  5. begin
  6. assign(f,'longpath.in');
  7. reset(f);
  8. read(f,n,m);
  9. for i:=1 to m do
  10. begin
  11. read(f,x,y);
  12. dp[y]:=max(dp[y],dp[x]+1);
  13. if dp[y]>ans
  14. then ans:=dp[y];
  15. end;
  16. close(f);
  17.  
  18. assign(f,'longpath.out');
  19. rewrite(f);
  20. writeln(f,ans);
  21. close(f);
  22. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement