結果

問題 No.1373 Directed Operations
ユーザー tktk_snsntktk_snsn
提出日時 2021-02-05 21:56:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 352 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 98,936 KB
最終ジャッジ日時 2023-09-15 08:07:10
合計ジャッジ時間 6,092 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,416 KB
testcase_01 AC 80 ms
71,184 KB
testcase_02 AC 148 ms
97,892 KB
testcase_03 AC 119 ms
97,616 KB
testcase_04 AC 123 ms
98,844 KB
testcase_05 AC 75 ms
71,192 KB
testcase_06 AC 341 ms
98,792 KB
testcase_07 AC 93 ms
76,928 KB
testcase_08 AC 109 ms
77,960 KB
testcase_09 AC 319 ms
98,936 KB
testcase_10 AC 289 ms
95,612 KB
testcase_11 AC 128 ms
78,768 KB
testcase_12 AC 279 ms
95,568 KB
testcase_13 AC 103 ms
77,072 KB
testcase_14 AC 343 ms
98,644 KB
testcase_15 AC 307 ms
95,892 KB
testcase_16 AC 352 ms
98,604 KB
testcase_17 AC 186 ms
92,400 KB
testcase_18 AC 114 ms
85,904 KB
testcase_19 AC 182 ms
84,400 KB
testcase_20 AC 229 ms
88,004 KB
権限があれば一括ダウンロードができます

ソースコード

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