Submission #321269

# Submission time Handle Problem Language Result Execution time Memory
321269 2020-11-11T19:37:46 Z xyzyzl A Huge Tower (CEOI10_tower) C++14
90 / 100
44 ms 2404 KB
#include <bits/stdc++.h>

#define MOD 1000000009
#define ll long long
using namespace std;

int n, d, a[100005];
ll w[100005], tot[100005];
int main()
{
	cin >> n >> d; for(int i = 0; i < n; i++) cin >> a[i];
	sort(a, a+n);
	tot[0] = 1;
	int lo=0;
	for(int i = 0; i < n; i++)
	{
		while(a[lo]+d < a[i]) lo++;
		w[i] = (i-lo)+1;
	}
	// for(int i = 0; i < n; i++) cerr << w[i] << endl;
	for(int i = 1; i < n; i++)
	{
		tot[i] = (tot[i-1]*w[i]) % MOD;
	}
	cout << tot[n-1] << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 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 512 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 5 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1772 KB Output is correct
2 Correct 26 ms 1764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 44 ms 2404 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 44 ms 2404 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -