結果

問題 No.930 数列圧縮
ユーザー NoneNone
提出日時 2021-03-18 05:38:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 624 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 287,400 KB
最終ジャッジ日時 2024-04-27 18:43:43
合計ジャッジ時間 8,064 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 116 ms
106,420 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
# rank=[2,4,1,...]: A[2]<A[4]<A[1],...
rank,sortedA=zip(*sorted(enumerate(A),key=lambda x:x[1],reverse=True))

rank=list(rank)

res=[]
r=N
M=0
j_max=-1
while rank:
    i=rank.pop()
    if i>=r:
        continue
    if (r!=N and A[i]>=A[-1]) or i==N-1:
        print("No")
        exit()

    for j in range(i+1,r):
        if M<A[j]:
            M=A[j]
            if j_max>=r:
                res.append(j_max+1)
            j_max=j
    for j in range(i,r):
        if j!=j_max:
            res.append(j+1)
    A=A[:i]
    A.append(M)
    r=len(A)-1
print("Yes")
print(*res)
0