Submission #1006336

#TimeUsernameProblemLanguageResultExecution timeMemory
1006336addsdA Huge Tower (CEOI10_tower)Java
100 / 100
876 ms45452 KiB
import java.util.*; import java.io.*; public class tower { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int N = in.nextInt(), D = in.nextInt(), M = 1_000_000_009; int[] block = new int[N]; for (int i = 0; i < N; i++) block[i] = in.nextInt(); Arrays.sort(block); long ways = 1; for (int i = 1, p = 0; i < N; i++) { while (p < i && block[p] + D < block[i]) p++; ways = ((i - p + 1) * ways) % M; } System.out.println(ways); } }
#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...