Need help on simple queue simulation problem

Правка en1, от firmanhp, 2015-07-24 05:42:27

Problem link (UVa 10901 — Ferry Loading III)

I got WA on this problem (if you're interested with my source code, here.)

After searching for some tricky cases, I found something that I don't understand.

1
4 3 3
76 left
83 left
97 left

and the expected output is: (udebug)

79
89
103

while my program outputs:

79
86
100

Which I think is the correct answer.

Explanation: The ferry waits on the left, until the first car arrives (time:76) and then it travels to the right side (the car arrives to destination at 76+3=79). Then, the ferry goes back to the left side (time:79+3=82) and waits until the second car arrives (time:83) and goes to the right side again (**time:83+3=86**). Then, the ferry goes back to the left side again (time:86+3=89) and waited until (time:97) and goes to the right side (**time:97+3=100**)

The time for all cars to be unloaded is 79, 86, and 100 respectively.

Am I missing something important about the problem?

Теги uva 10901, help

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский firmanhp 2015-07-24 05:43:52 5
en1 Английский firmanhp 2015-07-24 05:42:27 1269 Initial revision (published)