Submission #1045401

# Submission time Handle Problem Language Result Execution time Memory
1045401 2024-08-05T23:21:31 Z bluecornbot A Huge Tower (CEOI10_tower) C++14
55 / 100
1000 ms 2652 KB
#include <iostream>
#include <fstream>
#include <string>
#include <bits/stdc++.h>

using namespace std;

	// ofstream fout ("split.out");
	// ifstream fin ("split.in");


	
	
	



int main(){
	
	int n,d;
	cin>>n>>d;
	int array[n];
	long long product=1;
	for(int i=0;i<n;i++){
		cin>>array[i];
	}
	sort(array,array+n);
	for(int i=1;i<n;i++){
		int j=i-1;
		while(j>=0&&array[j]+d>=array[i]){
			j--;
		}
		product=product*(i-j);
	}
	// for(int i=n-1;i>=0;i--){
	// 	int j=i-1;
	// 	while(array[i]<=d+array[j]){
	// 		j--;
	// 	}
	// 	product=product*(i-j)%1000000009;
	// }
	// cout<<product;




	// long long product=1;

	// for(int i=0;i<n;i++){
	// 	cout<<barray[i]<<endl;
	// }
	// for(int i=0;i<n;i++){
	// 	product*=(barray[i]+1);
	// }

	cout<<product%1000000009;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 334 ms 1372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 2652 KB Time limit exceeded
2 Halted 0 ms 0 KB -