Submission #935254

#TimeUsernameProblemLanguageResultExecution timeMemory
935254GloriousSpacePotatoA Huge Tower (CEOI10_tower)C++17
100 / 100
94 ms15280 KiB
#include <bits/stdc++.h> #define MOD ((ll) 1e9 + 9) using namespace std; using ll = long long; vector<ll> blocks; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); ll n, d; cin >> n >> d; for (ll i{0}; i < n; i++) { ll b; cin >> b; blocks.push_back(b); } sort(blocks.begin(), blocks.end()); ll ans{1}; ll right{0}; for (ll left{0}; left < n; left++) { while (right < n && blocks[left] + d >= blocks[right]) { right++; } ans *= (right - left) % MOD; ans %= 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...