結果

問題 No.1373 Directed Operations
ユーザー paruf4paruf4
提出日時 2021-02-06 09:16:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 551 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 2,059 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 93,140 KB
最終ジャッジ日時 2023-09-15 13:55:54
合計ジャッジ時間 8,007 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,356 KB
testcase_01 AC 70 ms
70,852 KB
testcase_02 AC 145 ms
91,772 KB
testcase_03 AC 110 ms
92,052 KB
testcase_04 AC 112 ms
92,852 KB
testcase_05 AC 72 ms
71,064 KB
testcase_06 AC 533 ms
92,968 KB
testcase_07 AC 97 ms
76,756 KB
testcase_08 AC 125 ms
78,508 KB
testcase_09 AC 300 ms
93,140 KB
testcase_10 AC 266 ms
90,752 KB
testcase_11 AC 117 ms
78,604 KB
testcase_12 AC 260 ms
90,488 KB
testcase_13 AC 97 ms
77,120 KB
testcase_14 AC 551 ms
92,736 KB
testcase_15 AC 489 ms
90,628 KB
testcase_16 AC 550 ms
92,724 KB
testcase_17 AC 199 ms
88,140 KB
testcase_18 AC 114 ms
84,528 KB
testcase_19 AC 252 ms
82,576 KB
testcase_20 AC 323 ms
85,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
b = [(a[i],i) for i in range(n-1)]
b.sort()

c = [0]*n

for a,_ in b:
    c[a] += 1

s = 0
for i in range(1,n):
    s += c[i]
    if s < i:
        print("NO")
        exit(0)

print("YES")
res = []

for i in range(n-1):
    a,j = b[i]
    res.append((j,i+2-a))

res.sort()
for _,val in res:
    print(val)
0