結果

問題 No.2210 equence Squence Seuence
ユーザー ShirotsumeShirotsume
提出日時 2022-11-28 08:01:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 1,204 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 130,940 KB
最終ジャッジ日時 2024-04-15 10:18:44
合計ジャッジ時間 5,296 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
54,976 KB
testcase_01 AC 49 ms
54,260 KB
testcase_02 AC 44 ms
55,224 KB
testcase_03 AC 91 ms
86,452 KB
testcase_04 AC 94 ms
88,856 KB
testcase_05 AC 114 ms
99,212 KB
testcase_06 AC 105 ms
94,092 KB
testcase_07 AC 161 ms
110,912 KB
testcase_08 AC 46 ms
54,052 KB
testcase_09 AC 46 ms
54,196 KB
testcase_10 AC 45 ms
55,792 KB
testcase_11 AC 45 ms
55,072 KB
testcase_12 AC 43 ms
54,376 KB
testcase_13 AC 187 ms
115,464 KB
testcase_14 AC 187 ms
115,716 KB
testcase_15 AC 187 ms
115,424 KB
testcase_16 AC 191 ms
115,528 KB
testcase_17 AC 189 ms
115,484 KB
testcase_18 AC 43 ms
54,500 KB
testcase_19 AC 44 ms
54,792 KB
testcase_20 AC 45 ms
54,776 KB
testcase_21 AC 44 ms
54,392 KB
testcase_22 AC 44 ms
54,116 KB
testcase_23 AC 168 ms
122,756 KB
testcase_24 AC 149 ms
123,392 KB
testcase_25 AC 162 ms
130,940 KB
testcase_26 AC 181 ms
119,420 KB
testcase_27 AC 100 ms
94,116 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:
                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])
    p.pop()
    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()
    print(X)
    return X[k - 1]

n, k = mi()

a = li()

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

0