Submission #480405

#TimeUsernameProblemLanguageResultExecution timeMemory
480405nehasaneA Huge Tower (CEOI10_tower)C++14
5 / 100
99 ms2636 KiB
#include <bits/stdc++.h> using namespace std; const int mod = 1000000009; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 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; 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; l = r-1; } 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...