結果

問題 No.2210 equence Squence Seuence
ユーザー flygonflygon
提出日時 2023-02-10 23:56:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 126,524 KB
最終ジャッジ日時 2023-09-22 00:48:13
合計ジャッジ時間 6,296 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,716 KB
testcase_01 AC 89 ms
71,428 KB
testcase_02 AC 91 ms
71,616 KB
testcase_03 AC 133 ms
86,716 KB
testcase_04 AC 129 ms
88,420 KB
testcase_05 AC 142 ms
96,956 KB
testcase_06 AC 136 ms
92,796 KB
testcase_07 AC 180 ms
121,196 KB
testcase_08 AC 91 ms
71,752 KB
testcase_09 AC 91 ms
71,420 KB
testcase_10 AC 89 ms
71,576 KB
testcase_11 AC 91 ms
71,732 KB
testcase_12 AC 92 ms
71,612 KB
testcase_13 AC 192 ms
124,212 KB
testcase_14 AC 194 ms
126,344 KB
testcase_15 AC 192 ms
126,268 KB
testcase_16 AC 189 ms
124,464 KB
testcase_17 AC 188 ms
124,980 KB
testcase_18 AC 88 ms
71,616 KB
testcase_19 AC 88 ms
71,416 KB
testcase_20 AC 91 ms
71,732 KB
testcase_21 AC 91 ms
71,572 KB
testcase_22 AC 91 ms
71,732 KB
testcase_23 AC 166 ms
118,588 KB
testcase_24 AC 149 ms
107,396 KB
testcase_25 AC 161 ms
113,648 KB
testcase_26 AC 178 ms
126,524 KB
testcase_27 AC 129 ms
89,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

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

p = [-1]*(n+1)

q = deque([])
mx = n
mn = 1
for i in range(n-1):
  q.append(i)
  if a[i] < a[i+1]:
    while q:
      p[mx] = q.pop()
      mx -= 1
  if a[i] > a[i+1]:
    while q:
      p[mn] = q.popleft()
      mn += 1
q.append(n-1)
for i in range(1, n+1):
  if p[i] == -1:
    p[i] = q.pop()
ans = []
for i in range(n):
  if i == p[k]:continue
  ans.append(a[i])

print(*ans)
0