Range Reconstruction
시간 제한2초메모리 제한1024 MB
모든 부분 배열의 최댓값과 최솟값의 차이가 주어질 때, 그 값들을 그대로 만족하는 배열을 하나 복원한다.
문제
Bessie has an array , where and for all . She won't tell you itself, but she will tell you the range of each subarray of . That is, for each pair of indices , Bessie tells you . Given these values of , please construct an array that could have been Bessie's original array. The values in your array should be in the range .
입력
The first line contains .
Another lines follow. The th of these lines contains the integers .
It is guaranteed that there is some array with values in the range such that for all , .
출력
Output one line containing integers in the range representing your array. They must satisfy for all .