아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Array of Discord

시간 제한1초메모리 제한1024 MB

요약
정렬된 목록에서 한 수의 한 자리만 바꿔 목록이 정렬되지 않게 만든다. 자릿수는 그대로여야 하고 앞에 0이 오면 안 된다.
난이도

보통10점 중 6점

유형
그리디, 문자열, 구현
정답자
아직 제출이 없습니다

문제

Once upon a time, high up on Mount Olympus, it came to pass that the gods held a competition to see who among them was the best at sorting lists of integers.  Eris, the goddess of discord, finds this terribly boring and plans to add some mischief to the mix to make things more fun.  She will sabotage the answers of Zeus so that his list of numbers is no longer sorted, which will no doubt be so embarrassing that he becomes furious and starts a minor war.

Eris must be careful not to be discovered while performing her sabotage, so she decides to only change a single digit in one of the numbers in Zeus' answer.  The resulting number may not have any leading zeros (unless it becomes equal to zero in which case a single zero digit is allowed).  Eris can only replace a digit with another digit -- adding or removing digits is not allowed.

입력

The first line of input contains nn (2≤n≤1002 \leq n \leq 100), the length of Zeus' answer.  The second line contains nn integers a_1,a_2,…,a_na\_1, a\_2, \ldots, a\_n (0≤a_1≤a_2≤…≤a_n≤10150 \leq a\_1 \le a\_2 \le \ldots \le a\_n \leq 10^{15}), Zeus' answer.

출력

If Eris can make the list not be sorted by changing a single digit of one of the numbers, then output nn integers b_1,…,b_nb\_1, \ldots, b\_n, the resulting list of numbers after making the change.  Otherwise, output "impossible".  If there are many valid solutions, any one will be accepted.

예제3

  1. 예제 1

    입력
    3
    2020 2020 2020
    
    예상 출력
    2021 2020 2020
    
  2. 예제 2

    입력
    2
    1 9999999
    
    예상 출력
    impossible
    
  3. 예제 3

    입력
    4
    1 42 4711 9876
    
    예상 출력
    1 42 4711 3876