結果

問題 No.1373 Directed Operations
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-02-05 22:18:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 320 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 10,604 KB
実行使用メモリ 23,508 KB
最終ジャッジ日時 2023-09-15 08:36:15
合計ジャッジ時間 4,666 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,476 KB
testcase_01 AC 18 ms
8,508 KB
testcase_02 AC 118 ms
15,424 KB
testcase_03 AC 81 ms
13,024 KB
testcase_04 AC 47 ms
20,076 KB
testcase_05 AC 18 ms
8,424 KB
testcase_06 AC 146 ms
23,508 KB
testcase_07 AC 21 ms
8,892 KB
testcase_08 AC 33 ms
10,656 KB
testcase_09 AC 48 ms
19,772 KB
testcase_10 AC 44 ms
18,028 KB
testcase_11 AC 25 ms
10,976 KB
testcase_12 AC 87 ms
18,964 KB
testcase_13 AC 21 ms
9,772 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 64 ms
11,656 KB
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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")
0