UVA12772 Dynamic accessible Pairs

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=823&page=show_problem&problem=4625 [PDF](https://uva.onlinejudge.org/external/127/p12772.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12772/98d7175de6241d985d70333e0fb3b101fca87eb6.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12772/25bc168ba567496bb521f0d1882702cb91475f65.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12772/6fed0f1ecf0ae458a4f1ff9c6b2f36bd914c2614.png)