結果

問題 No.2210 equence Squence Seuence
ユーザー ShirotsumeShirotsume
提出日時 2023-01-09 08:26:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 1,642 ms
コンパイル使用メモリ 86,724 KB
実行使用メモリ 142,240 KB
最終ジャッジ日時 2023-08-22 13:50:37
合計ジャッジ時間 9,059 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,432 KB
testcase_01 AC 92 ms
71,540 KB
testcase_02 AC 92 ms
71,768 KB
testcase_03 AC 135 ms
86,072 KB
testcase_04 AC 127 ms
87,508 KB
testcase_05 AC 141 ms
97,260 KB
testcase_06 AC 134 ms
92,604 KB
testcase_07 AC 181 ms
121,692 KB
testcase_08 AC 93 ms
71,744 KB
testcase_09 AC 92 ms
71,576 KB
testcase_10 AC 93 ms
71,600 KB
testcase_11 AC 91 ms
71,480 KB
testcase_12 AC 92 ms
71,564 KB
testcase_13 AC 194 ms
131,572 KB
testcase_14 AC 195 ms
133,288 KB
testcase_15 AC 196 ms
133,436 KB
testcase_16 AC 193 ms
131,864 KB
testcase_17 AC 194 ms
132,096 KB
testcase_18 AC 91 ms
71,724 KB
testcase_19 AC 91 ms
71,520 KB
testcase_20 AC 91 ms
71,612 KB
testcase_21 AC 91 ms
71,592 KB
testcase_22 AC 91 ms
71,292 KB
testcase_23 AC 179 ms
130,988 KB
testcase_24 AC 159 ms
116,208 KB
testcase_25 AC 168 ms
124,084 KB
testcase_26 AC 190 ms
142,240 KB
testcase_27 AC 127 ms
92,460 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()

p = [-1] * n
q = []

l = 0
r = n - 1
for i in range(n-1):
    q.append(i)
    if a[i] == a[i+1]:
        continue
    if a[i] < a[i+1]:
        while q:
            p[r] = q.pop()
            r -= 1
    if a[i] > a[i+1]:
        while q:
            p[l] = q.pop()
            l += 1
q.append(n-1)
while q:
    p[l] = q.pop()
    l += 1

ans = []
for i in range(n):
    if i == p[k-1]:
        continue
    ans.append(a[i])
print(*ans)
0