結果

問題 No.2210 equence Squence Seuence
ユーザー KudeKude
提出日時 2023-02-10 21:44:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 528 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 115,944 KB
最終ジャッジ日時 2023-09-21 22:51:50
合計ジャッジ時間 5,642 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,024 KB
testcase_01 AC 71 ms
71,028 KB
testcase_02 AC 70 ms
71,508 KB
testcase_03 AC 117 ms
86,256 KB
testcase_04 AC 115 ms
84,840 KB
testcase_05 AC 132 ms
91,784 KB
testcase_06 AC 114 ms
87,576 KB
testcase_07 AC 173 ms
108,492 KB
testcase_08 AC 71 ms
71,340 KB
testcase_09 AC 69 ms
71,304 KB
testcase_10 AC 68 ms
71,156 KB
testcase_11 AC 68 ms
71,448 KB
testcase_12 AC 68 ms
71,384 KB
testcase_13 AC 205 ms
115,816 KB
testcase_14 AC 196 ms
109,248 KB
testcase_15 AC 193 ms
109,192 KB
testcase_16 AC 192 ms
115,944 KB
testcase_17 AC 186 ms
108,428 KB
testcase_18 AC 68 ms
71,440 KB
testcase_19 AC 70 ms
71,304 KB
testcase_20 AC 70 ms
71,296 KB
testcase_21 AC 70 ms
71,136 KB
testcase_22 AC 71 ms
71,308 KB
testcase_23 AC 128 ms
107,064 KB
testcase_24 AC 118 ms
99,916 KB
testcase_25 AC 123 ms
103,016 KB
testcase_26 AC 139 ms
114,540 KB
testcase_27 AC 95 ms
85,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import groupby
n, k = map(int, input().split())
a = [(x, len(list(it))) for x, it in groupby(map(int, input().split()))]
k -= 1
l, r = 0, n
for i in range(len(a) - 1):
    x, cx = a[i]
    y, cy = a[i + 1]
    if x < y:
        lx, rx = r - cx, r
        if lx <= k < rx:
            break
        r -= cx
    else:
        lx, rx = l, l + cx
        if l <= k < rx:
            break
        l += cx
else:
    i = len(a) - 1
ans = []
for ii, (x, cx) in enumerate(a):
    ans += [x] * (cx - (ii == i))
print(*ans)
0