UVA611 Parallel Deadlock

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=8&page=show_problem&problem=552 [PDF](https://uva.onlinejudge.org/external/6/p611.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA611/b77fa1486f98f3acc887251d2def60262c011aeb.png)

Input Format

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

Output Format

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