Submission #725307

#TimeUsernameProblemLanguageResultExecution timeMemory
725307groshiA Huge Tower (CEOI10_tower)C++17
100 / 100
130 ms13512 KiB
#include<bits/stdc++.h> #define int long long using namespace std; int mod=1e9+9; int32_t main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); int n,m,x; cin>>n>>m; vector<int> Q; for(int i=1;i<=n;i++) { cin>>x; Q.push_back(x); } sort(Q.begin(),Q.end()); int wynik=1; int r=Q.size()-1; for(int i=Q.size()-1;i>=0;i--) { while(r>=1 && Q[i]-Q[r-1]<=m) r--; wynik*=(i-r+1); wynik%=mod; } cout<<wynik; return 0; }
#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...