結果
問題 | No.1373 Directed Operations |
ユーザー | yakeshiba |
提出日時 | 2021-06-07 23:56:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 162 ms / 2,000 ms |
コード長 | 494 bytes |
コンパイル時間 | 250 ms |
コンパイル使用メモリ | 82,360 KB |
実行使用メモリ | 106,936 KB |
最終ジャッジ日時 | 2024-11-25 06:09:18 |
合計ジャッジ時間 | 4,042 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
from collections import defaultdict import copy n = int(input()) Ao = list(map(int,input().split())) A = copy.deepcopy(Ao) A.sort() visited = [0]*n ans = defaultdict(list) visited[0] = 1 ind = 1 for a in A: try: if visited[ind-a]: visited[ind] = 1 ind += 1 ans[a].append(ind-a) else: print("NO") exit() except IndexError: print("NO") exit() print("YES") for a in Ao: print(ans[a].pop())