結果

問題 No.2210 equence Squence Seuence
ユーザー titiatitia
提出日時 2023-02-10 21:43:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 561 bytes
コンパイル時間 990 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 30,412 KB
最終ジャッジ日時 2023-09-21 22:49:42
合計ジャッジ時間 5,062 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,832 KB
testcase_01 AC 16 ms
7,772 KB
testcase_02 AC 15 ms
7,944 KB
testcase_03 WA -
testcase_04 AC 77 ms
13,824 KB
testcase_05 WA -
testcase_06 AC 98 ms
15,700 KB
testcase_07 AC 223 ms
26,700 KB
testcase_08 WA -
testcase_09 AC 15 ms
7,784 KB
testcase_10 AC 15 ms
7,816 KB
testcase_11 AC 15 ms
7,836 KB
testcase_12 AC 15 ms
7,760 KB
testcase_13 AC 280 ms
29,960 KB
testcase_14 AC 277 ms
30,156 KB
testcase_15 AC 281 ms
30,124 KB
testcase_16 AC 284 ms
30,008 KB
testcase_17 AC 281 ms
29,988 KB
testcase_18 AC 16 ms
7,892 KB
testcase_19 AC 15 ms
7,768 KB
testcase_20 AC 15 ms
7,832 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 179 ms
26,744 KB
testcase_24 AC 140 ms
22,036 KB
testcase_25 AC 165 ms
24,628 KB
testcase_26 AC 213 ms
30,412 KB
testcase_27 AC 70 ms
14,512 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