結果

問題 No.2210 equence Squence Seuence
ユーザー katonyonkokatonyonko
提出日時 2023-02-10 21:57:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 130,476 KB
最終ジャッジ日時 2023-09-21 23:10:25
合計ジャッジ時間 6,410 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,632 KB
testcase_01 AC 95 ms
71,720 KB
testcase_02 AC 99 ms
71,376 KB
testcase_03 AC 141 ms
88,280 KB
testcase_04 AC 148 ms
89,272 KB
testcase_05 AC 153 ms
97,636 KB
testcase_06 AC 143 ms
92,948 KB
testcase_07 AC 200 ms
103,908 KB
testcase_08 AC 98 ms
71,508 KB
testcase_09 AC 93 ms
71,636 KB
testcase_10 AC 92 ms
71,604 KB
testcase_11 AC 94 ms
71,576 KB
testcase_12 AC 95 ms
71,368 KB
testcase_13 AC 224 ms
111,584 KB
testcase_14 AC 217 ms
110,220 KB
testcase_15 AC 220 ms
110,612 KB
testcase_16 AC 221 ms
112,048 KB
testcase_17 AC 207 ms
112,896 KB
testcase_18 AC 95 ms
71,676 KB
testcase_19 AC 94 ms
71,644 KB
testcase_20 AC 91 ms
71,784 KB
testcase_21 AC 94 ms
71,804 KB
testcase_22 AC 92 ms
71,644 KB
testcase_23 AC 176 ms
119,788 KB
testcase_24 AC 161 ms
109,768 KB
testcase_25 AC 167 ms
114,632 KB
testcase_26 AC 191 ms
130,476 KB
testcase_27 AC 129 ms
89,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import sys
def input():
  return sys.stdin.readline()[:-1]
N,K=map(int,input().split())
A=list(map(int,input().split()))
front=deque()
back=deque()
tmp=1
flg=0
for i in range(N-1):
  if A[i]>A[i+1]:
    for j in range(tmp):
      front.append(i)
    if i==N-2: back.appendleft(N-1)
    tmp=1
    flg=0
  elif A[i]<A[i+1]:
    for j in range(tmp):
      back.appendleft(i)
    if i==N-2: front.append(N-1)
    tmp=1
    flg=1
  else:
    tmp+=1
    if i==N-2:
      for j in range(tmp):
        if flg==0: back.appendleft(N-1)
        else: back.append(N-1)
k=(front+back)[K-1]
ans=[A[i] for i in range(N) if i!=k]
print(*ans)
0