結果

問題 No.1373 Directed Operations
ユーザー nephrologistnephrologist
提出日時 2021-02-05 21:38:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 100,624 KB
最終ジャッジ日時 2023-09-15 07:26:50
合計ジャッジ時間 6,757 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,280 KB
testcase_01 AC 70 ms
71,472 KB
testcase_02 AC 135 ms
100,224 KB
testcase_03 WA -
testcase_04 AC 93 ms
91,460 KB
testcase_05 AC 70 ms
71,292 KB
testcase_06 AC 326 ms
100,568 KB
testcase_07 AC 90 ms
76,656 KB
testcase_08 AC 107 ms
78,016 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 89 ms
87,984 KB
testcase_13 AC 76 ms
76,244 KB
testcase_14 AC 338 ms
100,448 KB
testcase_15 AC 297 ms
97,408 KB
testcase_16 AC 338 ms
100,556 KB
testcase_17 AC 167 ms
94,424 KB
testcase_18 AC 107 ms
87,148 KB
testcase_19 AC 173 ms
84,712 KB
testcase_20 AC 213 ms
88,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.buffer.readline
n = int(input())

A = list(map(int, input().split()))

memo = [0] * (n + 1)

for a in A:
    memo[a] += 1

capacity = 0
for i in range(n):
    capacity += 1
    capacity -= memo[-(i + 1)]
    if capacity < 0:
        print("NO")
        exit()

used = [0] * (n + 1)
now = 2
ans = [-1] * (n - 1)
kouho = []
for (idx, a) in enumerate(A):
    kouho.append((a, idx))
kouho.sort()
for a, idx in kouho:
    ans[idx] = now - a
    now += 1
print("YES")
for a in ans:
    print(a)

0