結果

問題 No.1373 Directed Operations
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-02-05 22:29:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 295 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 28,856 KB
最終ジャッジ日時 2023-09-15 08:55:41
合計ジャッジ時間 4,353 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,904 KB
testcase_01 AC 15 ms
8,104 KB
testcase_02 AC 135 ms
25,324 KB
testcase_03 WA -
testcase_04 AC 45 ms
19,644 KB
testcase_05 AC 15 ms
7,788 KB
testcase_06 AC 217 ms
25,964 KB
testcase_07 AC 18 ms
8,708 KB
testcase_08 AC 33 ms
10,404 KB
testcase_09 AC 46 ms
19,452 KB
testcase_10 AC 40 ms
17,988 KB
testcase_11 AC 22 ms
10,768 KB
testcase_12 WA -
testcase_13 AC 19 ms
9,388 KB
testcase_14 AC 241 ms
28,856 KB
testcase_15 AC 210 ms
26,156 KB
testcase_16 AC 249 ms
28,796 KB
testcase_17 AC 119 ms
21,488 KB
testcase_18 AC 71 ms
15,984 KB
testcase_19 AC 84 ms
15,324 KB
testcase_20 AC 119 ms
17,952 KB
権限があれば一括ダウンロードができます

ソースコード

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