问题
Farmer John wants to fairly split haybales between his two favorite cows Bessie and Elsie. He has
Farmer John is considering splitting a contiguous range of haybales
You are given
输入
First line contains
Second line contains
Third line contains
Next
输出
Output
子任务
| 编号 | 分数 | 条件 |
|---|---|---|
| #1 | 20分 | |
| #2 | 30分 | At most |
| #3 | 50分 | 추가 제약 조건 없음 |
示例 #1
2
3 1
15
1 1 -2
1 1 -1
1 1 0
1 1 1
1 1 2
1 2 -2
1 2 -1
1 2 0
1 2 1
1 2 2
2 2 -2
2 2 -1
2 2 0
2 2 1
2 2 2
1
2
3
-2
-1
0
1
2
-1
0
-1
0
1
0
1
For the 1st query, Elsie starts with
For the 3rd query, Elsie and Bessie start with the same number of hay. After processing haybale
For the 9th query, Bessie starts with
示例 #2
5
4 4 3 1 1
7
1 1 20
1 2 20
1 5 20
1 1 0
1 5 0
1 4 0
3 5 2
16
12
7
4
1
2
1
In the 5th query, there are