Submission #668733

#TimeUsernameProblemLanguageResultExecution timeMemory
668733Dec0DeddA Huge Tower (CEOI10_tower)C++14
90 / 100
47 ms3100 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1e5+10; const ll MOD = 1e9+9; ll a[N], n, d; int main() { cin>>n>>d; for (int i=1; i<=n; ++i) cin>>a[i]; sort(a+1, a+n+1); ll ans=1, r=1; for (ll i=1; 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...