Advertisement
Guest User

mccme.ru #1994

a guest
Dec 17th, 2012
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. ##http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1994#1
  2.  
  3. TL: 1 sec
  4. ML: 16M
  5.  
  6. You are given a weighted directed graph. The vertices are enumerated from (1) to (n).
  7. If (i<j),then there is an edge from vertex (i) to vertex (j), the weight of which is
  8. defined by: wt(i,j) = (179*i+719*j) mod 1000 - 500
  9. Your task is to find the shortest path between the vertex (1) and the vertex (n).
  10.  
  11. Input
  12. There first line contains one integer (n) (2ā‰¤nā‰¤13000)
  13.  
  14. Output
  15. Write the shortest path weight.
  16.  
  17. Sample test(s):
  18. input:
  19. 2
  20. output:
  21. 117
  22. input:
  23. 3
  24. output:
  25. -164
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement