제출 #762673

#제출 시각아이디문제언어결과실행 시간메모리
762673lalig777A Huge Tower (CEOI10_tower)C++14
35 / 100
1070 ms7576 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]++; 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...