問題
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