Submission #542296

#TimeUsernameProblemLanguageResultExecution timeMemory
542296RishabhPrabhuA Huge Tower (CEOI10_tower)Java
95 / 100
1084 ms30208 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(); int d = in.nextInt(); int[] b = new int[n]; for(int i = 0; i < n; i++) { b[i] = in.nextInt(); } Arrays.sort(b); long ans = 1; int lowerP = 0; for(int i = 1; i < n; i++) { while(b[lowerP] < b[i]-d) { lowerP++; } ans *= (i - lowerP + 1); ans %= 1000000009; } System.out.println(ans); System.out.close(); } }
#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...