cf/mirror

Tree Queries

CF
1904E2500· grandmaster4s512 MB⌨ stdin/stdout

Examples

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