Submission #393964

#TimeUsernameProblemLanguageResultExecution timeMemory
393964jadDebugsA Huge Tower (CEOI10_tower)C++14
30 / 100
306 ms5140 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 ans = 1; for (int l = 0, r = 0; l < n; l++) { while (r < n - 1 && arr[r+1] - arr[l] <= d) r++; ans = ((r-l+1) * ans*1LL) % mod; } 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...