Submission #934216

#TimeUsernameProblemLanguageResultExecution timeMemory
934216tkaimA Huge Tower (CEOI10_tower)Java
100 / 100
438 ms70504 KiB
import java.io.*; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; class tower { public static void main(String[] args) throws IOException { //BufferedReader reader = new BufferedReader(new FileReader(new File("diamond.in"))); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); //PrintWriter out = new PrintWriter(new FileWriter(new File("diamond.out"))); StringTokenizer sTokenizer = new StringTokenizer(reader.readLine()); int numCount = Integer.parseInt(sTokenizer.nextToken()); int difference = Integer.parseInt(sTokenizer.nextToken()); int[] blocks = new int[numCount]; sTokenizer = new StringTokenizer(reader.readLine()); for(int i = 0; i < numCount; i++) { blocks[i] = Integer.parseInt(sTokenizer.nextToken()); } Arrays.sort(blocks); long answer = 1; int upBlock = 0; for(int i = 0; i < numCount; i++) { while (upBlock < numCount - 1 && blocks[upBlock + 1] - blocks[i] <= difference) {upBlock++;} int multiplier = upBlock - i + 1; answer = ((long)multiplier * answer) % 1000000009; } System.out.println(answer); } }
#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...