cf/mirror

Gifts Fixing

CF
1399B800· newbie1s256 MB⌨ stdin/stdout
#greedy

Examples

Sample 1of 1
Input
5
3
3 5 6
3 2 3
5
1 2 3 4 5
5 4 3 2 1
3
1 1 1
2 2 2
6
1 1000000000 1000000000 1000000000 1000000000 1000000000
1 1 1 1 1 1
3
10 12 8
7 5 4
Output
6
16
0
4999999995
7
1399B.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)