Submit solution
Points:
1.40
Time limit:
2.0s
Memory limit:
512M
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
3
4 6
1 2 2
1 3 2
1 4 3
2 3 5
2 4 3
3 4 2
2 1
1 2 3
5 4
1 2 1
2 3 2
3 4 5
4 5 2
Sample Output 1
6
3 2 4 1
3
2 1
20
2 4 1 5 3
Comments