Submission #852895

#TimeUsernameProblemLanguageResultExecution timeMemory
852895iamjiamingliuA Huge Tower (CEOI10_tower)Cpython 3
100 / 100
863 ms81340 KiB
import sys import bisect MOD = 10 ** 9 + 9 _, diff = map(int, input().split()) nums = list(map(int, sys.stdin.readline().strip().split())) nums.sort() ways = [0] * (len(nums) + 1) ways[0] = 1 for i, n in enumerate(nums): positions = i - bisect.bisect_left(nums, n - diff) + 1 ways[i + 1] = (ways[i] * positions) % MOD print(ways[-1])
#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...