結果

問題 No.1373 Directed Operations
ユーザー ayaoniayaoni
提出日時 2021-02-05 22:37:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 560 ms / 2,000 ms
コード長 798 bytes
コンパイル時間 2,174 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 95,028 KB
最終ジャッジ日時 2023-09-15 09:09:11
合計ジャッジ時間 9,131 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,256 KB
testcase_01 AC 72 ms
71,048 KB
testcase_02 AC 152 ms
93,472 KB
testcase_03 AC 110 ms
92,588 KB
testcase_04 AC 116 ms
93,816 KB
testcase_05 AC 72 ms
71,072 KB
testcase_06 AC 538 ms
95,028 KB
testcase_07 AC 96 ms
76,760 KB
testcase_08 AC 128 ms
78,464 KB
testcase_09 AC 316 ms
93,768 KB
testcase_10 AC 273 ms
91,496 KB
testcase_11 AC 122 ms
78,324 KB
testcase_12 AC 268 ms
91,056 KB
testcase_13 AC 98 ms
77,168 KB
testcase_14 AC 560 ms
94,920 KB
testcase_15 AC 494 ms
92,180 KB
testcase_16 AC 559 ms
94,452 KB
testcase_17 AC 202 ms
88,988 KB
testcase_18 AC 114 ms
84,412 KB
testcase_19 AC 256 ms
82,744 KB
testcase_20 AC 329 ms
85,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N = I()
A = LI()
SA = [(A[i],i) for i in range(N-1)]
SA.sort()

count = [0]*N
for a,i in SA:
    count[a] += 1

s = 0
for i in range(1,N):
    s += count[i]
    if s < i:
        print('NO')
        exit()

print('YES')
ANS = []
for i in range(N-1):
    a,j = SA[i]
    ANS.append((j,i+2-a))

ANS.sort()
for i in range(N-1):
    print(ANS[i][1])
0