Submission #917415

#TimeUsernameProblemLanguageResultExecution timeMemory
917415PM1A Huge Tower (CEOI10_tower)C++17
100 / 100
106 ms12676 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int mxn=2e6+5,M=1e9+9; ll n,a[mxn],ans=1,d; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>d; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); int p=1; for(int i=1;i<=n;i++){ while(d+a[p]<a[i])p++; ans=(ans*(i-p+1))%M; } 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...