시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 37 20 19 54.286%

## 문제

Every permutation A = (a1, ..., an) of numbers 1, ..., n can be coded by a sequence B = (b1, ..., bn) in which bi equals the number of all aj such that (j < i & aj > ai), for i = 1, ..., n.

The sequence B = (0, 0, 1, 0, 2, 0, 4) is the code of the permutation A = (1, 5, 2, 6, 4, 7, 3).

Write a program that:

• reads from the standard input the length n and successive elements of the sequence B,
• examines whether it is a code of some permutation of numbers 1, ..., n,
• if so, it finds that permutation and writes it in the standard output,
• otherwise it writes in the standard output one word NIE ("no").

## 입력

• In the first line of the standard input there is a positive integer n ≤ 30,000. It is the number of elements of the sequence B.
• In each of the following n lines there is one nonnegative integer not greater than 30,000. It is the successive element of the sequence B.

## 출력

The standard output should contain:

• in each of n consecutive lines - one element of the permutation A, whose code is the sequence B written in the standard input,
• one word NIE, if the sequence B is not a code of any permutation.

## 예제 입력 1

7
0
0
1
0
2
0
4


## 예제 출력 1

1
5
2
6
4
7
3


## 예제 입력 2

4
0
2
0
0


## 예제 출력 2

NIE
{"ft_lang_label":"__label__en","ft_lang_prob":0.68016297,"math_prob":0.995632,"size":527,"snap":"2021-04-2021-17","text_gpt3_token_len":241,"char_repetition_ratio":0.124282986,"word_repetition_ratio":0.0,"special_character_ratio":0.4971537,"punctuation_ratio":0.24848485,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9877758,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-04-22T23:24:32Z\",\"WARC-Record-ID\":\"<urn:uuid:c9399d7c-6906-4102-8f83-f8c62e81b7dd>\",\"Content-Length\":\"27333\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:529471e7-e885-4e09-adee-3c0ea104d654>\",\"WARC-Concurrent-To\":\"<urn:uuid:3e02af6d-7ea5-4a23-81f7-45ed9643c4eb>\",\"WARC-IP-Address\":\"52.194.157.171\",\"WARC-Target-URI\":\"https://www.acmicpc.net/problem/8120\",\"WARC-Payload-Digest\":\"sha1:V4GXRPYCX5RXRILIFFQMWRBZI77QEQYY\",\"WARC-Block-Digest\":\"sha1:XWOMMNWF2GSENLIUV5IEJ2IALITBHNRC\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-17/CC-MAIN-2021-17_segments_1618039563095.86_warc_CC-MAIN-20210422221531-20210423011531-00246.warc.gz\"}"}