cf/mirror

Trash Problem

CF
1418D2100· master3s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
5 6
1 2 6 8 10
1 4
1 9
0 6
0 10
1 100
1 50
Output
5
7
7
5
4
8
49
Sample 2of 2
Input
5 8
5 1 2 4 3
0 1
0 2
0 3
0 4
0 5
1 1000000000
1 1
1 500000000
Output
3
2
1
0
0
0
0
0
499999999
1418D.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)