Submission #345374

#TimeUsernameProblemLanguageResultExecution timeMemory
345374leu_nautA Huge Tower (CEOI10_tower)C++11
90 / 100
103 ms5764 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; const ll maxn=2e5+1,MOD=1e9+9; ll h[maxn]; int main() { ll n,d; cin>>n>>d; ll ans=1; for (ll i=1;i<=n;i++) cin>>h[i]; sort(h+1,h+1+n); for (ll i=1;i<=n;i++) { ll pos=upper_bound(h+1,h+1+n,h[i]-d-1)-h; //cerr<<pos<<" "; if (h[pos]>=h[i]-d) pos=i-pos+1; else pos=1; //cerr<<pos<<endl; //pos++; ans*=pos; ans%=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...