Submission #809163

# Submission time Handle Problem Language Result Execution time Memory
809163 2023-08-05T19:38:16 Z jackliy369 A Huge Tower (CEOI10_tower) Python 3
0 / 100
1000 ms 72920 KB
N, D = map(int, input().split())
blocks = sorted(list(map(int, input().split())))

def binary_search_i(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

def binary_search_j(l, r, size, list):
    ans = l
    while r >= l:
        m = (l + r) // 2
        if list[m] > size + D:
            r = m - 1
            ans = list[m]
        else:
            l = m + 1
    return ans

ans = 1
i = 0
j = 1
while j < N:
    prev_j = j
    # while i < j and blocks[j] > blocks[i] + D:
    #     i += 1
    i = binary_search_i(i, j - 1, blocks[j], blocks)
    j = binary_search_j(prev_j, N - 1, blocks[i], blocks)
    for k in range(prev_j, j + 1):
        ans *= k - i + 1

print(ans % 1000000009)
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 2900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 2904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 2856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 2900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 2904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 2900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 2900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 3252 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 3248 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 3248 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 3320 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 3316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 3276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 3432 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 3348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 3476 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 4360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 8456 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 30600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 72920 KB Time limit exceeded
2 Halted 0 ms 0 KB -