cf/mirror

Array and Segments (Easy version)

CF
1108E11800· expert2s256 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
5 4
2 -2 3 1 2
1 3
4 5
2 5
1 3
Output
6
2
1 4
Sample 2of 3
Input
5 4
2 -2 3 1 4
3 5
3 4
2 4
2 5
Output
7
2
3 2
Sample 3of 3
Input
1 0
1000000
Output
0
0
1108E1.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)