Submit solution
Points:
1.80
Time limit:
2.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
4
2 1 2
1 2 3 8
2 4 3
1 2 6 10
1 2 1 3
2 1 2 7
2 1 0 3
6 8 1
3 6 4 8
1 5 0 6
1 3 0 3
5 4 1 3
6 3 5 10
5 4 5 7
5 6 3 10
4 5 5 8
4 4 5
1 2 4 5
1 2 3 1
2 4 3 3
3 1 9 6
Sample Output 1
6
0
3
-1
Comments