Submission #727140

# Submission time Handle Problem Language Result Execution time Memory
727140 2023-04-20T05:27:44 Z dn4271 A Huge Tower (CEOI10_tower) Java 11
30 / 100
1000 ms 26928 KB
import java.util.*;

public class tower {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int d = input.nextInt();
		int[] blocks = new int[n];
		for (int i = 0; i < n; i++) {
			blocks[i] = input.nextInt();
		}
		
		Arrays.sort(blocks);
		
		int[] tolerance = new int[n];
		tolerance[0] = 1;
		for (int i = 1; i < n; i++) {
			int j = 0;
			while (blocks[i] - blocks[j] > d) {
				j++;
			} 
			tolerance[i] = i - j + 1;
		}
		
		int answer = 1;
		
		for (int i: tolerance) {
			answer = answer * i;
		}
		
		System.out.println(answer);
	}

}
# Verdict Execution time Memory Grader output
1 Correct 101 ms 10656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 97 ms 10160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 10304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 97 ms 10104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 10184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 10008 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 125 ms 10020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 102 ms 10228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 10124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 105 ms 10044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 136 ms 10060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 10044 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 10156 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 111 ms 10076 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 257 ms 12500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 398 ms 20792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 612 ms 23136 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 24728 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1056 ms 26928 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1030 ms 22660 KB Time limit exceeded
2 Halted 0 ms 0 KB -