답안 #934203

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934203 2024-02-27T01:13:17 Z tkaim A Huge Tower (CEOI10_tower) Java 11
0 / 100
124 ms 29504 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(System.out);
    //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 = 1;
	for(int i = 0; i < numCount; i++) {
		if(upBlock >= numCount) {
			int num = numCount - i;
			if(num != 0) {
				answer *= num;
				answer = answer % 1000000009;
			}
			continue;
		}
		if(blocks[upBlock] > difference + blocks[i]) {
			int num = upBlock - i;
			if(num != 0) {
				answer *= num;
				answer = answer % 1000000009;
			}
			
			continue;
		}
		i--;
		upBlock++;
	}
	out.println(answer);
	out.close();
  }
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 105 ms 25632 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 107 ms 29268 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 109 ms 29308 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 110 ms 25284 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 108 ms 25424 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 103 ms 29496 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 109 ms 24984 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 115 ms 29260 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 107 ms 25080 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 106 ms 25176 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 103 ms 25124 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 102 ms 25632 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 118 ms 24864 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 104 ms 29504 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 105 ms 25672 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 106 ms 29468 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 108 ms 29340 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 116 ms 29316 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 124 ms 29424 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 103 ms 26076 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -