Submission #672361

# Submission time Handle Problem Language Result Execution time Memory
672361 2022-12-15T16:58:30 Z scrge A Huge Tower (CEOI10_tower) C++17
100 / 100
254 ms 10500 KB
#include <bits/stdc++.h>
#define int long long
#define MOD (int) 1e9+9
using namespace std;

int n, d;
vector<int> a;

signed main(){
	cin >> n >> d;
	a.resize(n);
	for(int i = 0; i < n; i++)
		cin >> a[i];
	sort(a.rbegin(), a.rend());
	int j = 0;
	int ans = 1;
	for(int i = 0; i < n; i++){
		while(j+1 < n && a[j+1]+d >= a[i]) j++;
		ans *= j+1-i;
		ans %= MOD;
	}

	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 596 KB Output is correct
2 Correct 22 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 117 ms 2260 KB Output is correct
2 Correct 106 ms 4640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 250 ms 5196 KB Output is correct
2 Correct 254 ms 10500 KB Output is correct