Submission #1082849

#TimeUsernameProblemLanguageResultExecution timeMemory
1082849rcllA Huge Tower (CEOI10_tower)C++17
100 / 100
181 ms11088 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int MOD=1e9+9; signed main() { int n,d; cin >> n >> d; vector<int> ar(n); for (int i=0; i<n; i++) { cin >> ar[i]; } sort(ar.begin(),ar.end()); int r=0, ans=1; for (int l=0; l<n; l++) { while (r<n-1 && ar[r+1]-ar[l]<=d) { r++; } int dist =r-l+1; ans=(ans*1LL*dist)%MOD; } cout << ans << 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...