E. Minimum Cost Spanning Subgraph
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Example
Input
2
3
3 1 2
5
9 5 1 4 10
Output
1
4