문제
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