Submission #135921

# Submission time Handle Problem Language Result Execution time Memory
135921 2019-07-24T13:35:58 Z imyujin A Huge Tower (CEOI10_tower) C++14
100 / 100
512 ms 8904 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long lint;

const int MOD = 1e9 + 9;
const int MAXN = 1e6 + 5;

int A[MAXN];

int main() {
	int N, D;
	lint ans = 1;

	cin >> N >> D;
	for(int i = 0; i < N; i++) cin >> A[i];

	sort(A, A + N);
	int p = 0;
	for(int i = 0; i < N; i++) {
		while(A[p] < A[i] - D) p++;
		ans = ans * (i - p + 1) % MOD;
	}

	cout << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 984 KB Output is correct
2 Correct 43 ms 1028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 230 ms 3668 KB Output is correct
2 Correct 209 ms 3716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 512 ms 8904 KB Output is correct
2 Correct 487 ms 8252 KB Output is correct