cf/mirror

Coloring Trees

CF
711C1700· expert2s256 MB⌨ stdin/stdout
#dp

Examples

Sample 1of 4
Input
3 2 2
0 0 0
1 2
3 4
5 6
Output
10
Sample 2of 4
Input
3 2 2
2 1 2
1 3
2 4
3 5
Output
-1
Sample 3of 4
Input
3 2 2
2 0 0
1 3
2 4
3 5
Output
5
Sample 4of 4
Input
3 2 3
2 1 2
1 3
2 4
3 5
Output
0
711C.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)