Submission #1097923

# Submission time Handle Problem Language Result Execution time Memory
1097923 2024-10-08T15:58:37 Z sosuke A Huge Tower (CEOI10_tower) PyPy 3
30 / 100
223 ms 103320 KB
MOD = 10**9 + 7

n, d = map(int, input().split())
ar = list(map(int, input().split()))
ar.sort()  # sort the blocks
r = 0
sol = 1
for l in range(n):
    while r < n - 1 and ar[r + 1] - ar[l] <= d:
        r += 1
    dist = r - l + 1  # largest tower we can build when ar[l] block is the base
    sol = (sol * dist) % MOD
    
print(sol)

# Verdict Execution time Memory Grader output
1 Correct 26 ms 18224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 18168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 18236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 18228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 18236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 18236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 18232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 18236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 18228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 18228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 18228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 18228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 18228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 18236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 18228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 20016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 19968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 25984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 52104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 103320 KB Output isn't correct
2 Halted 0 ms 0 KB -