cf/mirror

Perform Operations to Maximize Score

CF
1998C1900· candidate master3s256 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
8
2 10
3 3
1 1
3 10
3 3 3
0 0 0
4 4
2 1 5 1
0 1 0 1
5 4
7 5 2 5 4
0 0 1 0 1
5 1
5 15 15 2 11
1 0 0 1 1
5 2
10 11 4 10 15
1 1 0 1 0
4 4
1 1 2 5
1 1 0 0
2 1000000000
1000000000 1000000000
1 1
Output
16
6
8
13
21
26
8
3000000000
1998C.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)