Submission #899728

#TimeUsernameProblemLanguageResultExecution timeMemory
899728ivazivaA Huge Tower (CEOI10_tower)C++14
100 / 100
97 ms10092 KiB
#include <bits/stdc++.h> using namespace std; #define MOD 1000000009 #define MAXN 100010 long long n,d; vector<long long> niz; int main() { ios_base::sync_with_stdio(false); ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>d; for (long long i=1;i<=n;i++) { long long x; cin>>x; niz.push_back(x); } sort(niz.begin(),niz.end()); long long ans=1; long long j=0; for (long long i=0;i<n;i++) { while (j<n-1 and niz[j+1]-niz[i]<=d) j++; long long br=j-i+1; ans*=br; if (ans>=MOD) ans%=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...