Submission #373610

# Submission time Handle Problem Language Result Execution time Memory
373610 2021-03-05T08:54:06 Z randomjohnnyh A Huge Tower (CEOI10_tower) C++14
100 / 100
298 ms 2796 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	const int mod = (int)1e9+9;
	int ans = 1;
	int l = 0;
	for (int r = 0; r < n; r++) {
		while (v[l] < v[r] - m) { l++; }
		ans = (long long)ans * (r-l+1) % mod;
	}
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 620 KB Output is correct
2 Correct 27 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 129 ms 1388 KB Output is correct
2 Correct 126 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 294 ms 2796 KB Output is correct
2 Correct 298 ms 2796 KB Output is correct