Submission #517209

#TimeUsernameProblemLanguageResultExecution timeMemory
517209EvangA Huge Tower (CEOI10_tower)C++17
100 / 100
119 ms13588 KiB
#include <bits/stdc++.h> using namespace std; const int mod = 1e9+9; int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, d; cin >> n >> d; vector<int> a(n), ans(n), b(n); for(int i = 0; i < n; ++i) cin >> a[i]; sort(begin(a), end(a)); int p = 0; for(int i = 1; i < n; ++i){ while(a[p] + d < a[i]) ++p; b[i] = i - p; } ans[0] = 1; for(int i = 1; i < n; ++i) ans[i] = (ans[i-1] * (long long)(b[i]+1)) % mod; cout << ans.back(); }
#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...