#2067 Water Gate Management

2 s   128 MB  

Description

link

Sample Input

Sample Output

4
720000 120000
50000 60000
130000 50000
1200000 150000
3
5000000 7
5000000 30
63000000 24
Case 1: 120000
Case 2: 110000
Case 3: IMPOSSIBLE

Source

2011 ACM-ICPC Asia Phuket Regional