ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1162. Currency Exchange

I have one test, on which your AC programs may give incorrect answer (which use Belman-Ford mainly).(+)
Posted by Kit 7 Jul 2005 12:23
3 2 1 10
1 2 1 0 10 100
2 3 1.01 0 1 0


Right answer: YES.

First operation: 1 => 2. Sum[2] = 10.
Second operation: (2 => 3) & (3 => 2). Sum[2] = 10*1.01.
Repeat {second operation} until {sum[2] > 101}.
Third action: 2 => 1. Sum[1] = (sum[2] - 100)*10 > 10.

May be, I did not understood 1162? Condition about "simple sequences" obviously hold.
Bellman-Ford will not find such long cycle. I am right?