#560
Unrated
Tests for Haybales
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Farmer John's cows have decided to offer a programming contest for the cows on Farmer Nhoj's farm. In order to make the problems as fun as possible, they have spent considerable time coming up with challenging input cases. For one problem in particular, "Haybales", the cows need your help devising challenging inputs. This involve solving the following somewhat intriguing problem:

There is an array of sorted integers x1x2xNx_1 \leq x_2 \leq \dotsb \leq x_N (1N1051 \leq N \leq 10^5), and an integer KK. You don't know the array or KK, but you do know for each index ii, the largest index jij_i such that xjixi+Kx_{j_i} \leq x_i + K. It is guaranteed that ijii\le j_i and j1j2jNNj_1\le j_2\le \cdots \le j_N\le N.

Given this information, Farmer John's cows need to construct any array along with some integer KK that matches that information. The construction needs to satisfy 0xi10180 \leq x_i \leq 10^{18} for all ii and 1K10181 \leq K \leq 10^{18}.

It can be proven that this is always possible. Help Farmer John's cows solve this problem!

입력

The first line of input contains NN. The next line contains j1,j2,,jNj_1,j_2,\ldots,j_N.

출력

Print KK, then x1,,xNx_1,\ldots,x_N on separate lines. Any valid output will be accepted.

예제 입력 1

6
2 2 4 5 6 6

예제 출력 1

6
1
6
17
22
27
32

점수

For 50% of all inputs, N5000N\le 5000For the remaining inputs, there are no additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.