Submission #135921

#TimeUsernameProblemLanguageResultExecution timeMemory
135921imyujinA Huge Tower (CEOI10_tower)C++14
100 / 100
512 ms8904 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...