Submission #393963

#TimeUsernameProblemLanguageResultExecution timeMemory
393963jadDebugsA Huge Tower (CEOI10_tower)C++14
35 / 100
327 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 r = 1, l = 0; r < n; r++) { while (l < r && arr[l] + d < arr[r]) l++; 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...