結果
問題 | No.2210 equence Squence Seuence |
ユーザー |
![]() |
提出日時 | 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 sysinput = sys.stdin.readlineN,K=map(int,input().split())A=list(map(int,input().split()))ANS=[-1]*Nlast=N-1first=0for i in range(N-1):if A[i]>A[i+1]:ANS[first]=ifirst+=1while i-1>=0 and A[i]==A[i-1]:i-=1ANS[first]=ifirst+=1elif A[i]<A[i+1]:ANS[last]=ilast-=1while i-1>=0 and A[i]==A[i-1]:i-=1ANS[last]=ilast-=1x=ANS[K-1]if x==-1:print(*A[:-1])else:print(*A[:x]+A[x+1:])