Submission #797695

#TimeUsernameProblemLanguageResultExecution timeMemory
797695jackliy369A Huge Tower (CEOI10_tower)Cpython 3
90 / 100
1082 ms72880 KiB
from cmath import sqrt from math import floor, log2 N, D = map(int, input().split()) blocks = sorted(list(map(int, input().split()))) def binary_search(l, r, size, list): ans = r + 1 while r >= l: # m = (l + r) // 2 m = l + floor(log2(r - l + 1)) if size <= list[m] + D: r = m - 1 ans = m else: l = m + 1 return ans ans = 1 tower = [blocks[0]] index = 0 for i in range(1, N): possibilities = 1 index = binary_search(index, len(tower) - 1, blocks[i], tower) possibilities += len(tower) - index ans *= possibilities tower.append(blocks[i]) print(ans % 1000000009)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...