Submission #1097923

#TimeUsernameProblemLanguageResultExecution timeMemory
1097923sosukeA Huge Tower (CEOI10_tower)Pypy 3
30 / 100
223 ms103320 KiB
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 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...