Submission #1045390

# Submission time Handle Problem Language Result Execution time Memory
1045390 2024-08-05T22:47:02 Z bluecornbot A Huge Tower (CEOI10_tower) C++14
55 / 100
1000 ms 11264 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];
	int barray[n]={0};
	for(int i=0;i<n;i++){
		cin>>array[i];
	}
	sort(array,array+n);
	int pointeri=n-1;
	int pointerj=n-2;
	while(pointerj>=0){
		if(pointerj==0){
			if(pointeri==1){
				if(array[pointerj]+d<array[pointeri]){
					pointerj--;
				}
				else{
					barray[pointeri]++;
					pointerj--;
				}
			}
			else{
				if(array[pointerj]+d<array[pointeri]){
					pointeri--;
					pointerj=pointeri-1;
				}
				else{
					barray[pointeri]++;
					pointeri--;
					pointerj=pointeri-1;
				}
				
			}
		}
		else{
			if(array[pointerj]+d<array[pointeri]){
				pointeri--;
				pointerj=pointeri-1;
			}
			else{
				barray[pointeri]++;
				pointerj--;
			}
		}
	}


	long long product=1;

	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 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 1 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 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 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 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 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 1064 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 574 ms 4816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 11264 KB Time limit exceeded
2 Halted 0 ms 0 KB -