Submission #1130290

#TimeUsernameProblemLanguageResultExecution timeMemory
1130290NewtonabcA Huge Tower (CEOI10_tower)C++20
100 / 100
246 ms4648 KiB
#include<bits/stdc++.h> using namespace std; const long long MOD=1e9+9; vector<int> v; int main(){ int n,d; cin>>n >>d; long long ans=1; for(int i=1;i<=n;i++){ int inp; cin>>inp; v.push_back(inp); } sort(v.begin(),v.end()); for(int i=0;i<n;i++){ long long tmp=i-(lower_bound(v.begin(),v.end(),v[i]-d)-v.begin()); ans=(ans*(tmp+1LL))%MOD; } cout<<ans; }
#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...