結果

問題 No.2210 equence Squence Seuence
ユーザー titia
提出日時 2023-02-10 21:37:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 31,052 KB
最終ジャッジ日時 2024-07-07 15:49:11
合計ジャッジ時間 4,714 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 6 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

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
    else:
        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:])
    
0