結果

問題 No.1373 Directed Operations
ユーザー marroncastlemarroncastle
提出日時 2021-02-05 21:52:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 1,279 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 106,128 KB
最終ジャッジ日時 2023-09-15 08:02:48
合計ジャッジ時間 5,713 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,856 KB
testcase_01 AC 92 ms
71,764 KB
testcase_02 AC 152 ms
88,932 KB
testcase_03 AC 114 ms
88,972 KB
testcase_04 AC 118 ms
90,656 KB
testcase_05 AC 90 ms
71,696 KB
testcase_06 AC 199 ms
106,128 KB
testcase_07 AC 115 ms
78,148 KB
testcase_08 AC 116 ms
78,988 KB
testcase_09 AC 143 ms
95,224 KB
testcase_10 AC 131 ms
92,472 KB
testcase_11 AC 107 ms
80,248 KB
testcase_12 AC 125 ms
88,428 KB
testcase_13 AC 101 ms
77,696 KB
testcase_14 AC 212 ms
94,040 KB
testcase_15 AC 195 ms
91,192 KB
testcase_16 AC 215 ms
94,124 KB
testcase_17 AC 160 ms
88,024 KB
testcase_18 AC 127 ms
83,220 KB
testcase_19 AC 145 ms
88,120 KB
testcase_20 AC 165 ms
94,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
ans = 'YES'
cum = 0
now = 1
lis = [[] for _ in range(N)]
for i in range(1,N):
  cum += C[i]
  if cum<i:
    ans = 'NO'
    break
  for _ in range(C[i]):
    now += 1
    lis[i].append(now)
print(ans)
if ans=='YES':
  for i in range(N-1):
    print(lis[A[i]].pop()-A[i])
0