로딩
요청 처리 중입니다...

[TopCoder] 키위주스(시뮬레이션)_1

 [TopCoder] 키위주스(시뮬레이션)_1

[문제 ]Taro has prepared delicious kiwi fruit juice. He poured it into N bottles numbered from 0 to N-1.

The capacity of the i-th bottle is capacities[i] liters, and he poured bottles[i] liters of kiwi juice into this bottle. Now he wants to redistribute juice in the bottles.

In order to do this, he will perform M operations numbered from 0 to M-1 in the order in which he will perform them. For the i-th operation, he will pour kiwi juice from bottle from Id[i] to bottle toId[i].

He will stop pouring when bottle fromId[i] becomes empty or bottle toId[i] becomes full, whichever happens earlier. ..........