Submission #668735

#TimeUsernameProblemLanguageResultExecution timeMemory
668735Dec0DeddA Huge Tower (CEOI10_tower)C++14
100 / 100
311 ms10520 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1e5+10; const ll MOD = 1e9+9; int main() { ll n, d; cin>>n>>d; vector<ll> a(n); for (int i=0; i<n; ++i) cin>>a[i]; sort(a.begin(), a.end()); ll ans=1, r=0; for (ll i=0; i<n; ++i) { r=max(i, r); while (r < n && a[i]+d >= a[r]) ++r; (ans*=r-i)%=MOD; } cout<<ans<<"\n"; }
#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...