Submission #934208

# Submission time Handle Problem Language Result Execution time Memory
934208 2024-02-27T01:30:37 Z tkaim A Huge Tower (CEOI10_tower) Java 11
0 / 100
118 ms 31372 KB
import java.io.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

class App {
 
  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 time Memory Grader output
1 Runtime error 103 ms 26136 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 108 ms 25468 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 108 ms 29804 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 104 ms 25760 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 104 ms 25476 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 109 ms 25176 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 107 ms 27616 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 113 ms 25032 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 103 ms 25256 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 104 ms 25412 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 114 ms 29816 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 109 ms 29540 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 110 ms 25448 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 104 ms 25776 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 106 ms 31372 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 114 ms 24896 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 106 ms 25272 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 106 ms 29464 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 108 ms 31240 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 118 ms 25240 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -