雕塑 Sculpture

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=243&page=show_problem&problem=3323 [PDF](https://uva.onlinejudge.org/external/121/p12171.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12171/978f31007b2d2710615f089e658f2a312338d9e3.png)

输入输出格式

输入格式


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

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12171/0523230c6b891030a21b548b9f8f3102cdeea20e.png)

输入输出样例

输入样例 #1

2
2
1 2 3 3 4 5
6 2 3 3 4 5
7
1 1 1 5 5 1
1 1 10 5 5 1
1 1 2 1 4 8
2 1 2 4 1 8
5 2 2 1 4 8
1 5 2 4 1 8
3 3 4 1 1 1

输出样例 #1

188 120
250 250