結果

問題 No.2210 equence Squence Seuence
ユーザー chankei271828chankei271828
提出日時 2023-02-10 22:11:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 198 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 142,432 KB
最終ジャッジ日時 2023-09-21 23:27:03
合計ジャッジ時間 5,916 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,768 KB
testcase_01 AC 93 ms
71,700 KB
testcase_02 AC 92 ms
71,544 KB
testcase_03 AC 124 ms
86,220 KB
testcase_04 AC 125 ms
87,220 KB
testcase_05 AC 140 ms
97,116 KB
testcase_06 AC 135 ms
92,544 KB
testcase_07 AC 177 ms
121,836 KB
testcase_08 AC 93 ms
71,720 KB
testcase_09 AC 92 ms
71,748 KB
testcase_10 AC 92 ms
71,788 KB
testcase_11 AC 92 ms
71,424 KB
testcase_12 AC 91 ms
71,720 KB
testcase_13 AC 194 ms
131,676 KB
testcase_14 AC 193 ms
133,308 KB
testcase_15 AC 194 ms
133,392 KB
testcase_16 AC 193 ms
131,940 KB
testcase_17 AC 191 ms
132,036 KB
testcase_18 AC 92 ms
71,724 KB
testcase_19 AC 93 ms
71,656 KB
testcase_20 AC 91 ms
71,784 KB
testcase_21 AC 91 ms
71,728 KB
testcase_22 AC 93 ms
71,668 KB
testcase_23 AC 178 ms
130,900 KB
testcase_24 AC 161 ms
116,388 KB
testcase_25 AC 179 ms
124,320 KB
testcase_26 AC 198 ms
142,432 KB
testcase_27 AC 131 ms
92,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N,K=map(int,input().split())
A=list(map(int,input().split()))
d=deque()
ans=[-1]*N
l=0
r=N-1
res=[]
for i in range(N-1):
    if A[i]>A[i+1]:
        res.append(i)
        while res:
            j=res.pop()
            ans[l]=j
            l+=1
    elif A[i]<A[i+1]:
        res.append(i)
        while res:
            j=res.pop()
            ans[r]=j
            r-=1
    else:
        res.append(i)
while res:
    j=res.pop()
    ans[l]=j
    l+=1
ans[l]=N-1
ans_seq=[]
for i in range(N):
    if i!=ans[K-1]:
        ans_seq.append(A[i])
print(*ans_seq)
0