cf/mirror

1-Trees and Queries

CF
1304E2000· candidate master4s512 MB⌨ stdin/stdout

Examples

Sample 1of 1
Input
5
1 2
2 3
3 4
4 5
5
1 3 1 2 2
1 4 1 3 2
1 4 1 3 3
4 2 3 3 9
5 2 3 3 9
Output
YES
YES
NO
YES
NO
1304E.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…