Submission #345375

#TimeUsernameProblemLanguageResultExecution timeMemory
345375leu_nautA Huge Tower (CEOI10_tower)C++11
100 / 100
451 ms10732 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; const ll maxn=1e6+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...