Submission #762678

#TimeUsernameProblemLanguageResultExecution timeMemory
762678lalig777A Huge Tower (CEOI10_tower)C++14
10 / 100
219 ms7836 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main (){ int n, d; cin>>n>>d; vector<int>v(n); for (int i=0; i<n; i++) cin>>v[i]; sort(v.begin(), v.end()); vector<int>dp(n); vector<int>b(n); for (int i=0; i<n; i++){ for (int j=i-1; j>=0; j--){ if (v[i]<=v[j]+d) b[i]++; if (b[i]>1000000009) b[i]%=1000000009; else break; } }dp[0]=1; for (int i=1; i<n; i++) dp[i]=(dp[i-1]*(b[i]+1))%1000000009; cout<<dp[n-1]<<endl; 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...