Trees on My Island
题目描述
[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=12&page=show_problem&problem=1029
[PDF](https://uva.onlinejudge.org/external/100/p10088.pdf)
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10088/e714bde2c3c5e7d5a95bef96a0ec7e8b64961b35.png)
输入输出格式
输入格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10088/50d6dca7d5a8511c061de97db8816d0dab3a5bca.png)
输出格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10088/a01c1e9d5f18c93fb7466fd901f2d2af3a07570b.png)
输入输出样例
输入样例 #1
12
3 1
6 3
9 2
8 4
9 6
9 9
8 9
6 5
5 8
4 4
3 5
1 3
12
1000 1000
2000 1000
4000 2000
6000 1000
8000 3000
8000 8000
7000 8000
5000 4000
4000 5000
3000 4000
3000 5000
1000 3000
0
输出样例 #1
21
25990001