結果

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

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())
s = sorted(range(n-1),key = lambda i:a[i])
ans = [0]*(n-1)
for i in range(n-1):
    x = i+1-a[s[i]]
    if x < 0:
        print("NO")
        exit()
    ans[s[i]] = x+1
print("YES")
print(*ans)
0