UVA12277 Locks and keys

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=244&page=show_problem&problem=3429 [PDF](https://uva.onlinejudge.org/external/122/p12277.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12277/0b49ab9bdf6683a384d8fe199f4599d8cc13e857.png)

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12277/8f833ebda8b74b9baf19d950e60c8d2c346c891d.png)