Submit solution
Points:
0.70
Time limit:
1.0s
Memory limit:
512M
Input:
stdin
Output:
stdout
Problem source:
Problem type
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch
In case the statement didn't load correctly, you can download the statement here: Statement
Sample Input 1
7 8
1 2 1 3 2 1 2
2 1 6 1
3 6 5 4
2 3 3 6
2 1 7 5
1 6
2 6 1 1
3 7 6 5
2 4 4 7
Sample Output 1
46
45
0
0
10
58
36
Comments