cf/mirror

Balance (Hard version)

CF
1732D22400· grandmaster3s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
18
+ 1
+ 2
? 1
+ 4
? 2
+ 6
? 3
+ 7
+ 8
? 1
? 2
+ 5
? 1
+ 1000000000000000000
? 1000000000000000000
- 4
? 1
? 2
Output
3
6
3
3
10
3
2000000000000000000
3
4
Sample 2of 2
Input
10
+ 100
? 100
+ 200
? 100
- 100
? 100
+ 50
? 50
- 50
? 50
Output
200
300
100
100
50
1732D2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)