Submission #761062

#TimeUsernameProblemLanguageResultExecution timeMemory
761062lukehsiaoA Huge Tower (CEOI10_tower)C++14
100 / 100
96 ms8764 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1000000009; int n, D; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> D; vector<int> sz(n); for (int &x : sz) cin >> x; sort(sz.begin(), sz.end()); ll ans = 1; int l = 0; for (int r=1; r<n; ++r) { while (sz[l] < sz[r]-D) ++l; int spots = r-l; ans = ans * (spots+1) % 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...