結果
| 問題 | 
                            No.1373 Directed Operations
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-02-05 22:18:41 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 320 bytes | 
| コンパイル時間 | 86 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 25,316 KB | 
| 最終ジャッジ日時 | 2024-07-02 12:48:23 | 
| 合計ジャッジ時間 | 4,132 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 13 WA * 6 | 
ソースコード
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
if not n - 1 <= sum(a) <= n * (n - 1) // 2:
    exit(print("NO"))
d = defaultdict(int)
ans = []
for i in a:
    if d[i] + i >= n:
        exit(print("NO"))
    ans.append(d[i] + 1)
    d[i] += 1
print("YES")
print(*ans, sep="\n")