CF37C.Old Berland Language

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Berland scientists know that the Old Berland language had exactly nn words. Those words had lengths of l1,l2,...,lnl_{1},l_{2},...,l_{n} letters. Every word consisted of two letters, 00 and 11 . Ancient Berland people spoke quickly and didn’t make pauses between the words, but at the same time they could always understand each other perfectly. It was possible because no word was a prefix of another one. The prefix of a string is considered to be one of its substrings that starts from the initial symbol.

Help the scientists determine whether all the words of the Old Berland language can be reconstructed and if they can, output the words themselves.

输入格式

The first line contains one integer NN ( 1<=N<=10001<=N<=1000 ) — the number of words in Old Berland language. The second line contains NN space-separated integers — the lengths of these words. All the lengths are natural numbers not exceeding 10001000 .

输出格式

If there’s no such set of words, in the single line output NO. Otherwise, in the first line output YES, and in the next NN lines output the words themselves in the order their lengths were given in the input file. If the answer is not unique, output any.

输入输出样例

  • 输入#1

    3
    1 2 3
    

    输出#1

    YES
    0
    10
    110
    
  • 输入#2

    3
    1 1 1
    

    输出#2

    NO
    
首页