結果
| 問題 |
No.2210 equence Squence Seuence
|
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2023-02-10 23:55:53 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 136 ms / 2,000 ms |
| コード長 | 372 bytes |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 81,968 KB |
| 実行使用メモリ | 107,136 KB |
| 最終ジャッジ日時 | 2024-07-07 17:42:03 |
| 合計ジャッジ時間 | 3,972 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
from collections import deque
n,k=map(int,input().split())
a=list(map(int,input().split()))
dq=deque()
dq.append(n-1)
top=True
for i in range(n-2,-1,-1):
if a[i]<a[i+1]:
dq.append(i)
top=False
elif a[i]>a[i+1]:
dq.appendleft(i)
top=True
else:
if top:
dq.appendleft(i)
else:
dq.append(i)
ng=dq[k-1]
ans=a[:ng]+a[ng+1:]
print(*ans)
とりゐ