Submission #321269

#TimeUsernameProblemLanguageResultExecution timeMemory
321269xyzyzlA Huge Tower (CEOI10_tower)C++14
90 / 100
44 ms2404 KiB
#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 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...