結果

問題 No.2210 equence Squence Seuence
ユーザー ShirotsumeShirotsume
提出日時 2022-11-28 08:09:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,200 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 82,232 KB
実行使用メモリ 119,568 KB
最終ジャッジ日時 2024-04-15 10:18:49
合計ジャッジ時間 4,323 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,620 KB
testcase_01 AC 44 ms
54,136 KB
testcase_02 AC 45 ms
54,800 KB
testcase_03 AC 92 ms
86,468 KB
testcase_04 WA -
testcase_05 AC 121 ms
99,092 KB
testcase_06 AC 109 ms
94,292 KB
testcase_07 AC 166 ms
111,168 KB
testcase_08 AC 45 ms
54,696 KB
testcase_09 AC 49 ms
60,904 KB
testcase_10 AC 47 ms
59,536 KB
testcase_11 AC 48 ms
59,548 KB
testcase_12 AC 48 ms
61,252 KB
testcase_13 WA -
testcase_14 AC 190 ms
115,688 KB
testcase_15 AC 191 ms
115,712 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 44 ms
54,540 KB
testcase_19 AC 45 ms
53,936 KB
testcase_20 AC 44 ms
54,664 KB
testcase_21 AC 45 ms
54,692 KB
testcase_22 AC 45 ms
54,380 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
権限があれば一括ダウンロードができます

ソースコード

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 = []

    for i in range(n - 1):
        if p[i] < p[i + 1]:
            top.append(i)
            for v in same:
                top.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])
    return ans

def solveg(n, k, a):
    X = []
    for i in range(n):
        x = []
        for j in range(n):
            if i == j:
                continue
            x.append(a[j])
        X.append(x)

    X.sort()
    return X[k - 1]

n, k = mi()

a = li()

print(*solve(n, k, a) if n > 7000 else solveg(n, k, a))

0