Submission #393961

#TimeUsernameProblemLanguageResultExecution timeMemory
393961jadDebugsA Huge Tower (CEOI10_tower)C++14
35 / 100
301 ms6596 KiB
#include <iostream> #include <algorithm> #include <vector> using namespace std; const int mod = 1e9+9; int main() { int n, d; cin >> n >> d; vector<int> arr(n); vector<int> dp(n); dp[0] = 1; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr.begin(), arr.end()); int l = 0; for (int r = 1; r < n; r++) { while (l < r && arr[l] + d < arr[r]) l++; dp[r] = ((r-l+1) * dp[r-1]) % mod; dp[r] %= mod; } cout << dp[n-1]; }
#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...