結果

問題 No.2210 equence Squence Seuence
ユーザー ShirotsumeShirotsume
提出日時 2022-11-28 07:58:12
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 967 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 130,904 KB
最終ジャッジ日時 2024-04-15 10:07:38
合計ジャッジ時間 4,800 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
54,004 KB
testcase_01 AC 43 ms
54,464 KB
testcase_02 AC 43 ms
54,468 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 106 ms
94,428 KB
testcase_07 AC 163 ms
110,860 KB
testcase_08 WA -
testcase_09 AC 45 ms
54,080 KB
testcase_10 AC 45 ms
54,676 KB
testcase_11 AC 42 ms
53,852 KB
testcase_12 AC 43 ms
54,424 KB
testcase_13 AC 189 ms
115,452 KB
testcase_14 AC 188 ms
115,452 KB
testcase_15 AC 185 ms
115,884 KB
testcase_16 AC 192 ms
115,600 KB
testcase_17 WA -
testcase_18 AC 43 ms
54,192 KB
testcase_19 AC 43 ms
54,784 KB
testcase_20 WA -
testcase_21 AC 43 ms
55,516 KB
testcase_22 WA -
testcase_23 AC 166 ms
122,960 KB
testcase_24 AC 148 ms
123,172 KB
testcase_25 AC 163 ms
130,904 KB
testcase_26 AC 186 ms
119,256 KB
testcase_27 AC 100 ms
93,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
sys.setrecursionlimit(5 * 10 ** 5)
from pypyjit import set_param
set_param('max_unroll_recursion=-1')
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

def solve(n, k, p):
    top = []
    bottom = []
    same = []
    p.append(0)

    for i in range(n):
        if p[i] < p[i + 1]:
            top.append(i)
            for v in same:
                bottom.append(v)
            same = []
        elif p[i] > p[i + 1]:
            bottom.append(i)
            for v in same:
                bottom.append(v)
            same = []
        else:
            same.append(i)
    q = top + bottom[::-1]
    ind = q[n - k]
    ans = []
    for i in range(n):
        if i == ind:
            continue
        ans.append(p[i])
    p.pop()
    return ans

n, k = mi()

a = li()

print(*solve(n, k, a))

0