結果
| 問題 | 
                            No.1373 Directed Operations
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-02-13 01:02:01 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 178 ms / 2,000 ms | 
| コード長 | 347 bytes | 
| コンパイル時間 | 258 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 102,528 KB | 
| 最終ジャッジ日時 | 2024-07-20 02:35:10 | 
| 合計ジャッジ時間 | 4,728 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 19 | 
ソースコード
import sys
input = sys.stdin.readline
from collections import *
N = int(input())
a = list(map(int, input().split()))
b = a[:]
b.sort()
ans = defaultdict(list)
now = 1
for bi in b:
    if now-bi>=0:
        ans[bi].append(now-bi)
        now += 1
    else:
        print('NO')
        exit()
print('YES')
for ai in a:
    print(ans[ai].pop()+1)