結果

問題 No.1373 Directed Operations
ユーザー lloyzlloyz
提出日時 2023-08-03 20:27:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 386 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 98,060 KB
最終ジャッジ日時 2024-04-21 18:54:46
合計ジャッジ時間 6,308 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,712 KB
testcase_01 AC 40 ms
51,968 KB
testcase_02 AC 115 ms
96,792 KB
testcase_03 AC 94 ms
96,808 KB
testcase_04 AC 99 ms
97,936 KB
testcase_05 AC 39 ms
51,756 KB
testcase_06 AC 369 ms
97,200 KB
testcase_07 AC 59 ms
67,976 KB
testcase_08 AC 84 ms
76,968 KB
testcase_09 AC 358 ms
98,060 KB
testcase_10 AC 304 ms
94,760 KB
testcase_11 AC 105 ms
78,440 KB
testcase_12 AC 304 ms
94,560 KB
testcase_13 AC 75 ms
76,344 KB
testcase_14 AC 385 ms
97,716 KB
testcase_15 AC 330 ms
94,968 KB
testcase_16 AC 386 ms
97,636 KB
testcase_17 AC 153 ms
91,624 KB
testcase_18 AC 81 ms
85,100 KB
testcase_19 AC 166 ms
83,584 KB
testcase_20 AC 219 ms
87,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

AI = [(A[i], i) for i in range(n - 1)]
AI.sort(key=lambda x: (x[0], x[1]))
ANS = [-1 for _ in range(n - 1)]
G = [-1 for _ in range(n + 1)]
for i in range(2, n + 1):
    d, idx = AI[i - 2]
    if i - d <= 0:
        print("NO")
        exit()
    ANS[idx] = i - d
print("YES")
print(*ANS, sep='\n')
0