Submission #899720

#TimeUsernameProblemLanguageResultExecution timeMemory
899720ivazivaA Huge Tower (CEOI10_tower)C++14
90 / 100
929 ms2140 KiB
#include <bits/stdc++.h> using namespace std; #define MOD 1000000009 #define MAXN 100010 long long n,d; long long niz[MAXN]; 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++) cin>>niz[i]; sort(niz+1,niz+n+1); long long ans=1; for (long long i=1;i<=n;i++) { long long br=0; for (long long j=i-1;j>=1;j--) { if (niz[i]-niz[j]<=d) br++; else break; } ans*=(br+1); 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...