結果

問題 No.2210 equence Squence Seuence
ユーザー titiatitia
提出日時 2023-02-10 21:46:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 293 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 663 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 30,416 KB
最終ジャッジ日時 2023-09-21 22:54:47
合計ジャッジ時間 5,806 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,796 KB
testcase_01 AC 17 ms
7,820 KB
testcase_02 AC 17 ms
7,740 KB
testcase_03 AC 73 ms
13,752 KB
testcase_04 AC 82 ms
13,976 KB
testcase_05 AC 117 ms
16,528 KB
testcase_06 AC 101 ms
15,680 KB
testcase_07 AC 235 ms
26,732 KB
testcase_08 AC 16 ms
7,880 KB
testcase_09 AC 16 ms
7,792 KB
testcase_10 AC 16 ms
7,920 KB
testcase_11 AC 16 ms
7,664 KB
testcase_12 AC 16 ms
7,796 KB
testcase_13 AC 291 ms
29,956 KB
testcase_14 AC 288 ms
30,000 KB
testcase_15 AC 292 ms
29,992 KB
testcase_16 AC 286 ms
30,076 KB
testcase_17 AC 293 ms
30,128 KB
testcase_18 AC 16 ms
7,820 KB
testcase_19 AC 16 ms
7,664 KB
testcase_20 AC 16 ms
7,904 KB
testcase_21 AC 16 ms
7,792 KB
testcase_22 AC 16 ms
7,796 KB
testcase_23 AC 186 ms
26,812 KB
testcase_24 AC 145 ms
22,108 KB
testcase_25 AC 168 ms
24,700 KB
testcase_26 AC 217 ms
30,416 KB
testcase_27 AC 70 ms
14,348 KB
権限があれば一括ダウンロードができます

ソースコード

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