cf/mirror

Jumbled Trees

CF
1773J2900· international gm3s1024 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
3 3 101
1 2 30
2 3 40
3 1 50
Output
3
10 1 2
20 1 3
30 2 3
Sample 2of 3
Input
2 2 37
1 2 8
1 2 15
Output
2
8 1
15 2
Sample 3of 3
Input
5 4 5
1 3 1
2 3 2
2 5 3
4 1 4
Output
-1
1773J.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)