結果

問題 No.2210 equence Squence Seuence
ユーザー minimumminimum
提出日時 2023-02-10 22:14:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,312 KB
実行使用メモリ 131,188 KB
最終ジャッジ日時 2023-09-21 23:30:08
合計ジャッジ時間 5,593 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,136 KB
testcase_01 AC 70 ms
71,400 KB
testcase_02 AC 73 ms
71,256 KB
testcase_03 AC 104 ms
85,568 KB
testcase_04 AC 111 ms
87,664 KB
testcase_05 AC 120 ms
95,824 KB
testcase_06 AC 112 ms
91,912 KB
testcase_07 AC 148 ms
100,684 KB
testcase_08 AC 71 ms
71,308 KB
testcase_09 AC 72 ms
71,400 KB
testcase_10 AC 72 ms
71,112 KB
testcase_11 AC 74 ms
71,428 KB
testcase_12 AC 76 ms
71,568 KB
testcase_13 AC 164 ms
107,484 KB
testcase_14 AC 164 ms
107,436 KB
testcase_15 AC 164 ms
107,680 KB
testcase_16 AC 164 ms
107,684 KB
testcase_17 AC 165 ms
107,436 KB
testcase_18 AC 73 ms
71,344 KB
testcase_19 AC 73 ms
71,676 KB
testcase_20 AC 72 ms
71,404 KB
testcase_21 AC 71 ms
71,348 KB
testcase_22 AC 73 ms
71,080 KB
testcase_23 AC 154 ms
131,188 KB
testcase_24 AC 136 ms
117,532 KB
testcase_25 AC 144 ms
124,740 KB
testcase_26 AC 163 ms
120,780 KB
testcase_27 AC 105 ms
92,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
L, R = [], []
ls = []
for i in range(N - 1):
    ls.append(i)
    if A[i] < A[i + 1]:
        while ls:
            j = ls.pop()
            L.append(j)
    elif A[i] > A[i + 1]:
        while ls:
            j = ls.pop()
            R.append(j)
while ls:
    j = ls.pop()
    L.append(j)
R.append(N - 1)
L.reverse()
R += L
pos = R[K - 1]
ans = A[:pos] + A[pos+1:]
print(*ans)
0