Submission #385225

#TimeUsernameProblemLanguageResultExecution timeMemory
385225SansPapyrus683Rabbit Carrot (LMIO19_triusis)Cpython 3
100 / 100
558 ms21560 KiB
from typing import List from bisect import bisect_right def longest_nondec_subseq(arr: List[int]) -> int: min_endings = [] for i in arr: # bisect_right not left because it just has to be nondecreasing pos = bisect_right(min_endings, i) # standard LIS protocol if pos == len(min_endings): min_endings.append(i) else: min_endings[pos] = i return len(min_endings) pole_num, jump_height = [int(i) for i in input().split()] poles = [int(input()) for _ in range(pole_num)] poss_unchanged = [] for i, p in enumerate(poles): if (i + 1) * jump_height >= p: poss_unchanged.append((i + 1) * jump_height - p) print(pole_num - longest_nondec_subseq(poss_unchanged))
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...