結果

問題 No.1373 Directed Operations
ユーザー nephrologist
提出日時 2021-02-05 21:40:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 320 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 97,920 KB
最終ジャッジ日時 2024-07-02 11:53:09
合計ジャッジ時間 4,934 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

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

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


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
    if ans[idx] <= 0:
        print("NO")
        exit()
    now += 1
print("YES")
for a in ans:
    print(a)

0