Submission #768788

#TimeUsernameProblemLanguageResultExecution timeMemory
768788orcslopA Huge Tower (CEOI10_tower)C++17
100 / 100
99 ms14980 KiB
#include <bits/stdc++.h> using namespace std; #define sz(x) (int)(x).size() const int MOD = 1e9 + 9; int n, d; vector<int> blocks, v; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> d; for(int i = 0; i < n; i++){ int a; cin >> a; blocks.push_back(a); } sort(blocks.begin(), blocks.end()); int index = 0; for(int i = 0; i < n; i++){ while(index < n && blocks[index] + d < blocks[i]) index++; v.push_back(i - index); } long long ans = 1; for(auto x : v) ans = ans * (x + 1) % MOD; cout << ans; return 0; }
#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...