답안 #934204

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934204 2024-02-27T01:14:45 Z tkaim A Huge Tower (CEOI10_tower) Java 11
0 / 100
119 ms 31708 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++;
	}
	System.out.println(answer);
	out.close();
  }
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 113 ms 29412 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 104 ms 29060 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 105 ms 29828 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 107 ms 29700 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 104 ms 31420 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 104 ms 25164 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 105 ms 25152 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 113 ms 25620 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 102 ms 25584 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 104 ms 31708 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 107 ms 29408 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 104 ms 27472 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 113 ms 31396 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 105 ms 29816 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 102 ms 25780 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 109 ms 31376 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 105 ms 25252 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 104 ms 30004 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 119 ms 25264 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 109 ms 31176 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -