結果

問題 No.1373 Directed Operations
ユーザー NatsubiSogan
提出日時 2021-02-05 22:29:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 295 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 31,092 KB
最終ジャッジ日時 2024-07-02 13:03:09
合計ジャッジ時間 4,999 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
if not n - 1 <= sum(a) <= n * (n - 1) // 2:
    exit(print("NO"))
a2 = [(a[i], i) for i in range(n - 1)]
a2.sort()
ans = [0] * (n - 1)
for i in range(1, n)[::-1]:
    ans[a2[i - 1][1]] = i - a2[i - 1][0] + 1
print("YES")
print(*ans, sep="\n")
0