cf/mirror

Problem with Queries

CF
2043G3000· legendary gm8s1024 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
3
1 2 3
5
2 0 2
1 0 2
2 0 2
1 2 0
2 1 0
Output
3 2 0
Sample 2of 2
Input
7
1 3 4 4 7 1 3
3
2 1 6
2 1 0
2 5 6
Output
13 18 0
2043G.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)