結果

問題 No.1373 Directed Operations
ユーザー tktk_snsn
提出日時 2021-02-05 21:56:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 326 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 82,660 KB
実行使用メモリ 97,708 KB
最終ジャッジ日時 2024-07-02 12:27:18
合計ジャッジ時間 5,185 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [(a, i) for i, a in enumerate(A)]
    B.sort(reverse=True)

    ans = [-1] * (N - 1)
    for to in range(1, N):
        a, i = B.pop()
        if a > to:
            print("NO")
            return
        ans[i] = to - a + 1
    print("YES")
    print(*ans, sep="\n")


main()
0