문제
Bessie attended
For each session
Help Bessie by computing the earliest possible date of occurrence for each milking session. It is guaranteed that Bessie did not remember incorrectly; in other words, there exists an assignment of sessions to days in the range
SCORING:
Test cases 2-4 satisfy
N,C \le 10^3 .Test cases 5-10 satisfy no additional constraints.
Problem credits: Mark Gordon
입력
The first line of input contains
The next line contains
The next
출력
Output
예제1
4 10 3
1 2 3 4
1 2 5
2 4 2
3 4 4
1
6
3
8
Session two occurred at least five days after session one, so it cannot have occurred before day 1+5=6. Session four occurred at least two days after session two, so it cannot have occurred before day 6+2=8.