結果
| 問題 |
No.2210 equence Squence Seuence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-10 23:56:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 143 ms / 2,000 ms |
| コード長 | 669 bytes |
| コンパイル時間 | 153 ms |
| コンパイル使用メモリ | 82,252 KB |
| 実行使用メモリ | 107,252 KB |
| 最終ジャッジ日時 | 2024-07-07 17:42:57 |
| 合計ジャッジ時間 | 4,343 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
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)