Submission #391085

#TimeUsernameProblemLanguageResultExecution timeMemory
391085yu_limA Huge Tower (CEOI10_tower)Java
100 / 100
719 ms45380 KiB
import java.util.*; import java.io.*; public class tower { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer str = new StringTokenizer(br.readLine()); int N = Integer.parseInt(str.nextToken()); int D = Integer.parseInt(str.nextToken()); int[] block = new int[N]; str = new StringTokenizer(br.readLine()); for (int i = 0; i < N; i++) block[i] = Integer.parseInt(str.nextToken()); br.close(); Arrays.sort(block); long ans = 1; // # ways to make a tower with i blocks for (int i = 1, j = 0; i < N; i++) { while (j < i && block[j] + D < block[i]) j++; ans = ((i - j + 1) * ans) % (1000000009); } System.out.println(ans); } }
#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...