Submission #652743

#TimeUsernameProblemLanguageResultExecution timeMemory
652743EvidentSerenityA Huge Tower (CEOI10_tower)C++14
100 / 100
282 ms8140 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 9; int main () { int n, d; cin >> n >> d; vector<int> ar(n); for (int i = 0; i < n; i++) { cin >> ar[i]; } sort(ar.begin(), ar.end()); //sort the blocks int r = 0, sol = 1; for (int l = 0; l < n; l++) { while (r < n - 1 && ar[r + 1] - ar[l] <= d) r++; int dist = r - l + 1; //largest tower we can built when ar[l] block is the base sol = (sol * 1LL * dist) % MOD; } cout << sol << '\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...