結果
| 問題 |
No.2210 equence Squence Seuence
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2023-02-10 21:46:25 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 318 ms / 2,000 ms |
| コード長 | 562 bytes |
| コンパイル時間 | 105 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 31,180 KB |
| 最終ジャッジ日時 | 2024-07-07 15:59:09 |
| 合計ジャッジ時間 | 5,188 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
import sys
input = sys.stdin.readline
N,K=map(int,input().split())
A=list(map(int,input().split()))
ANS=[-1]*N
last=N-1
first=0
for i in range(N-1):
if A[i]>A[i+1]:
ANS[first]=i
first+=1
while i-1>=0 and A[i]==A[i-1]:
i-=1
ANS[first]=i
first+=1
elif A[i]<A[i+1]:
ANS[last]=i
last-=1
while i-1>=0 and A[i]==A[i-1]:
i-=1
ANS[last]=i
last-=1
x=ANS[K-1]
if x==-1:
print(*A[:-1])
else:
print(*A[:x]+A[x+1:])
titia