結果

問題 No.2210 equence Squence Seuence
ユーザー とりゐとりゐ
提出日時 2023-02-10 23:55:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 121,864 KB
最終ジャッジ日時 2023-09-22 00:47:19
合計ジャッジ時間 6,058 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,740 KB
testcase_01 AC 90 ms
71,780 KB
testcase_02 AC 90 ms
71,616 KB
testcase_03 AC 118 ms
83,528 KB
testcase_04 AC 123 ms
84,972 KB
testcase_05 AC 134 ms
94,300 KB
testcase_06 AC 130 ms
91,116 KB
testcase_07 AC 169 ms
114,628 KB
testcase_08 AC 90 ms
71,596 KB
testcase_09 AC 90 ms
71,956 KB
testcase_10 AC 90 ms
71,696 KB
testcase_11 AC 91 ms
71,592 KB
testcase_12 AC 91 ms
71,572 KB
testcase_13 AC 185 ms
118,560 KB
testcase_14 AC 186 ms
120,048 KB
testcase_15 AC 184 ms
120,132 KB
testcase_16 AC 185 ms
118,280 KB
testcase_17 AC 182 ms
118,792 KB
testcase_18 AC 90 ms
71,920 KB
testcase_19 AC 88 ms
71,676 KB
testcase_20 AC 88 ms
71,412 KB
testcase_21 AC 90 ms
71,840 KB
testcase_22 AC 89 ms
71,856 KB
testcase_23 AC 157 ms
113,140 KB
testcase_24 AC 143 ms
103,636 KB
testcase_25 AC 153 ms
108,632 KB
testcase_26 AC 169 ms
121,864 KB
testcase_27 AC 118 ms
86,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,k=map(int,input().split())
a=list(map(int,input().split()))
dq=deque()
dq.append(n-1)
top=True
for i in range(n-2,-1,-1):
  if a[i]<a[i+1]:
    dq.append(i)
    top=False
  elif a[i]>a[i+1]:
    dq.appendleft(i)
    top=True
  else:
    if top:
      dq.appendleft(i)
    else:
      dq.append(i)

ng=dq[k-1]
ans=a[:ng]+a[ng+1:]
print(*ans)
0