結果
問題 | No.2210 equence Squence Seuence |
ユーザー | kuro_B |
提出日時 | 2023-05-12 15:33:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 216 ms / 2,000 ms |
コード長 | 1,739 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 82,312 KB |
実行使用メモリ | 122,752 KB |
最終ジャッジ日時 | 2024-05-06 07:44:30 |
合計ジャッジ時間 | 7,300 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 129 ms
82,852 KB |
testcase_01 | AC | 131 ms
82,304 KB |
testcase_02 | AC | 131 ms
82,432 KB |
testcase_03 | AC | 159 ms
92,172 KB |
testcase_04 | AC | 162 ms
93,952 KB |
testcase_05 | AC | 178 ms
102,284 KB |
testcase_06 | AC | 171 ms
97,780 KB |
testcase_07 | AC | 200 ms
109,028 KB |
testcase_08 | AC | 128 ms
82,528 KB |
testcase_09 | AC | 129 ms
82,556 KB |
testcase_10 | AC | 126 ms
82,816 KB |
testcase_11 | AC | 127 ms
82,608 KB |
testcase_12 | AC | 126 ms
82,560 KB |
testcase_13 | AC | 208 ms
115,456 KB |
testcase_14 | AC | 210 ms
115,456 KB |
testcase_15 | AC | 216 ms
115,200 KB |
testcase_16 | AC | 212 ms
115,436 KB |
testcase_17 | AC | 215 ms
115,456 KB |
testcase_18 | AC | 129 ms
82,660 KB |
testcase_19 | AC | 131 ms
82,516 KB |
testcase_20 | AC | 132 ms
82,432 KB |
testcase_21 | AC | 129 ms
82,536 KB |
testcase_22 | AC | 129 ms
82,432 KB |
testcase_23 | AC | 197 ms
120,556 KB |
testcase_24 | AC | 193 ms
122,752 KB |
testcase_25 | AC | 195 ms
116,260 KB |
testcase_26 | AC | 211 ms
121,300 KB |
testcase_27 | AC | 167 ms
97,792 KB |
ソースコード
###スニペット始まり### import sys, re from copy import copy, deepcopy from math import ceil, floor, sqrt,factorial, gcd, pi, degrees, radians, sin, asin, cos, acos, tan, atan2 from statistics import mean, median from collections import Counter, deque, defaultdict from heapq import heapify, heappop, heappush from itertools import permutations, accumulate, product, combinations, combinations_with_replacement from bisect import bisect, bisect_left, bisect_right from functools import reduce, lru_cache from string import ascii_uppercase, ascii_lowercase from decimal import Decimal, ROUND_HALF_UP #四捨五入用 def input(): return sys.stdin.readline().rstrip('\n') #easy-testのpypyでは再帰数を下げる。 if __file__=='prog.py': sys.setrecursionlimit(10**5) else: sys.setrecursionlimit(10**6) def lcm(a, b): return a * b // gcd(a, b) #3つ以上の最大公約数/最小公倍数。Nを要素数、Mを数値の大きさとして、O(NlogM) def gcd_v2(l: list): return reduce(gcd, l) def lcm_v2(l: list): return reduce(lcm, l) #nPk def nPk(n, k): return factorial(n) // factorial(n - k) #逆元 def modinv(a, mod=10**9+7): return pow(a, mod-2, mod) INF = float('inf') MOD = 10 ** 9 + 7 ###スニペット終わり### N, K=map(int, input().split()) A=list(map(int, input().split())) A.append(-999)#番兵 res=[-1]*N L=0 R=N-1 stock=[] for i in range(N): stock.append(i) if A[i]>A[i+1]: while stock: res[L]=stock[-1] L+=1 stock.pop() elif A[i]<A[i+1]: while stock: res[R]=stock[-1] R-=1 stock.pop() ans_idx=res[K-1] ans=[] for i,a in enumerate(A[:N]): if i!=ans_idx: ans.append(a) print(*ans)