Submission #798291

# Submission time Handle Problem Language Result Execution time Memory
798291 2023-07-30T14:54:35 Z jackliy369 A Huge Tower (CEOI10_tower) Python 3
90 / 100
1000 ms 72920 KB
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(log10(r - l + 1))
#         # m = l + (r - l) // 1000000
#         if size <= list[m] + D:
#             r = m - 1
#             ans = m
#         else:
#             l = m + 1
#     return ans

ans = 1
index = 0
for i in range(1, N):
    while index < i and blocks[i] > blocks[index] + D:
        index += 1
    ans *= (i - index + 1) % 1000000009

print(ans % 1000000009)
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 2828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 2896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 3056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 3876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 466 ms 8328 KB Output is correct
2 Correct 541 ms 8328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 30480 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 72920 KB Time limit exceeded
2 Halted 0 ms 0 KB -