Submission #480395

#TimeUsernameProblemLanguageResultExecution timeMemory
480395nehasaneA Huge Tower (CEOI10_tower)C++14
90 / 100
1091 ms3672 KiB
#include <bits/stdc++.h> using namespace std; const int mod = 1000000009; int main() { int n, d; cin >> n >> d; vector <int> blocks(n); for (int i = 0; i < n; i++) cin >> blocks[i]; sort(begin(blocks), end(blocks)); long long ans = 1; for (int l = 0; l < n; l++){ int r = l; while (r < n){ if (blocks[l] + d < blocks[r]) break; r++; } ans = (ans * (r-l)) % mod; } cout << ans << '\n'; }
#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...