UVA12346 Water Gate Management

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=278&page=show_problem&problem=3768 [PDF](https://uva.onlinejudge.org/external/123/p12346.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12346/484e6eb628fa33f3723d8830fad2abd426625751.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12346/2df7ac0ffeefd6a6596bd97089c97360617e3ddc.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12346/b274791060078f99b0a00c401bd905b617369a07.png)