Submission #852898

# Submission time Handle Problem Language Result Execution time Memory
852898 2023-09-23T05:00:35 Z iamjiamingliu A Huge Tower (CEOI10_tower) Python 3
100 / 100
785 ms 75856 KB
import sys

MOD = 10 ** 9 + 9

_, diff = map(int, input().split())
nums = list(map(int, sys.stdin.readline().strip().split()))
nums.sort()

ways = 1
left_i = 0
for i, n in enumerate(nums):
    while n > nums[left_i] + diff:
        left_i += 1
    ways = (ways * (i - left_i + 1)) % MOD

print(ways)
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 2872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 3924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 8388 KB Output is correct
2 Correct 48 ms 8672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 276 ms 30488 KB Output is correct
2 Correct 243 ms 30664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 541 ms 73056 KB Output is correct
2 Correct 785 ms 75856 KB Output is correct