結果

問題 No.2210 equence Squence Seuence
ユーザー ShirotsumeShirotsume
提出日時 2023-02-11 00:15:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 252 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 121,352 KB
最終ジャッジ日時 2023-09-22 00:55:54
合計ジャッジ時間 6,477 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,580 KB
testcase_01 AC 100 ms
71,840 KB
testcase_02 AC 100 ms
71,624 KB
testcase_03 AC 129 ms
83,504 KB
testcase_04 AC 134 ms
85,156 KB
testcase_05 AC 146 ms
94,096 KB
testcase_06 AC 140 ms
91,072 KB
testcase_07 AC 179 ms
115,192 KB
testcase_08 AC 98 ms
71,688 KB
testcase_09 AC 98 ms
71,428 KB
testcase_10 AC 101 ms
71,708 KB
testcase_11 AC 100 ms
71,588 KB
testcase_12 AC 100 ms
71,428 KB
testcase_13 AC 195 ms
119,592 KB
testcase_14 AC 252 ms
120,992 KB
testcase_15 AC 199 ms
121,352 KB
testcase_16 AC 199 ms
119,516 KB
testcase_17 AC 200 ms
120,080 KB
testcase_18 AC 99 ms
71,572 KB
testcase_19 AC 100 ms
71,632 KB
testcase_20 AC 103 ms
71,732 KB
testcase_21 AC 103 ms
71,592 KB
testcase_22 AC 101 ms
71,380 KB
testcase_23 AC 172 ms
112,164 KB
testcase_24 AC 160 ms
104,472 KB
testcase_25 AC 165 ms
107,980 KB
testcase_26 AC 190 ms
120,740 KB
testcase_27 AC 183 ms
86,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n, k = mi()

a = li()

q = deque([n - 1])
prev = 0
for i in range(n - 2, -1, -1):
    if a[i] < a[i+1]:
        q.append(i)
        prev = 0
    elif a[i] > a[i+1]:
        q.appendleft(i)
        prev = 1
    elif prev:
        q.appendleft(i)
    else:
        q.append(i)


print(*(a[:q[k-1]] + a[q[k-1]+1:]))
    
0