cf/mirror

Maximum White Subtree

CF
1324F1800· expert2s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
9
0 1 1 1 0 0 0 0 1
1 2
1 3
3 4
3 5
2 6
4 7
6 8
5 9
Output
2 2 2 2 2 1 1 0 2
Sample 2of 2
Input
4
0 0 1 0
1 2
1 3
1 4
Output
0 -1 1 -1
1324F.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…