Submission #1068335

#TimeUsernameProblemLanguageResultExecution timeMemory
1068335Kiet07A Huge Tower (CEOI10_tower)C++14
100 / 100
85 ms8744 KiB
#include<bits/stdc++.h> using namespace std; long long mod=1e9+9; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,d; cin>>n>>d; vector<int>a(n); for(int i=0;i<n;i++) { cin>>a[i]; } sort(a.begin(),a.end()); long long ans=1; int l=0; for(int r=0;r<n;r++) { while(a[r]>a[l]+d) { l++; } ans=(ans*1ll*(r-l+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...