結果

問題 No.930 数列圧縮
ユーザー NoneNone
提出日時 2021-03-18 05:56:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 378 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 81,896 KB
実行使用メモリ 103,052 KB
最終ジャッジ日時 2024-04-27 18:56:38
合計ジャッジ時間 7,147 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 35 ms
52,096 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 47 ms
69,132 KB
testcase_14 AC 50 ms
70,400 KB
testcase_15 AC 119 ms
101,948 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 34 ms
51,712 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 34 ms
51,840 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
if A[0]>A[-1]:
    print("No")
    exit()


# 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-1
while rank:
    i=rank.pop()
    if i>=r:
        continue
    res.extend(range(i+2,r+1))
    res.append(i+1)
    r=i


print("Yes")
print(*res)
0