結果

問題 No.2210 equence Squence Seuence
ユーザー lloyzlloyz
提出日時 2023-02-10 22:51:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 118,932 KB
最終ジャッジ日時 2023-09-22 00:00:37
合計ジャッジ時間 6,616 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
71,432 KB
testcase_01 AC 105 ms
71,600 KB
testcase_02 AC 107 ms
71,908 KB
testcase_03 AC 161 ms
86,736 KB
testcase_04 AC 149 ms
88,312 KB
testcase_05 AC 173 ms
93,572 KB
testcase_06 AC 151 ms
89,864 KB
testcase_07 AC 196 ms
113,444 KB
testcase_08 AC 105 ms
71,444 KB
testcase_09 AC 107 ms
71,868 KB
testcase_10 AC 105 ms
71,460 KB
testcase_11 AC 105 ms
71,956 KB
testcase_12 AC 109 ms
71,740 KB
testcase_13 AC 208 ms
118,820 KB
testcase_14 AC 224 ms
111,172 KB
testcase_15 AC 217 ms
111,184 KB
testcase_16 AC 208 ms
118,764 KB
testcase_17 AC 214 ms
117,216 KB
testcase_18 AC 104 ms
71,868 KB
testcase_19 AC 102 ms
71,432 KB
testcase_20 AC 104 ms
71,748 KB
testcase_21 AC 103 ms
71,444 KB
testcase_22 AC 103 ms
71,744 KB
testcase_23 AC 179 ms
110,544 KB
testcase_24 AC 166 ms
102,948 KB
testcase_25 AC 173 ms
106,404 KB
testcase_26 AC 191 ms
118,932 KB
testcase_27 AC 140 ms
86,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n, k = map(int, input().split())
A = list(map(int, input().split()))

Que = deque(range(1, n + 1))
cnt = 0
for i in range(n - 1):
    cnt += 1
    if A[i] > A[i + 1]:
        for _ in range(cnt):
            r = Que.popleft()
            if r == k:
                ANS = A[:i] + A[i + 1:]
                print(*ANS)
                exit()
        cnt = 0
    elif A[i] < A[i + 1]:
        for _ in range(cnt):
            r = Que.pop()
            if r == k:
                ANS = A[:i] + A[i + 1:]
                print(*ANS)
                exit()
        cnt = 0
print(*A[:-1])
0