結果
問題 |
No.930 数列圧縮
|
ユーザー |
|
提出日時 | 2021-03-18 05:56:57 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 378 bytes |
コンパイル時間 | 408 ms |
コンパイル使用メモリ | 82,132 KB |
実行使用メモリ | 103,160 KB |
最終ジャッジ日時 | 2024-11-15 23:44:50 |
合計ジャッジ時間 | 8,388 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 5 WA * 19 |
ソースコード
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)