Submission #762664

#TimeUsernameProblemLanguageResultExecution timeMemory
762664AlmaA Huge Tower (CEOI10_tower)C++17
100 / 100
102 ms11228 KiB
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9+9; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, d; cin >> n >> d; vector<int> a(n), b(n); for (int& i: a) cin >> i; sort(a.begin(), a.end()); int k = 0; for (int i = 0; i < n; i++) { while (a[k] + d < a[i]) { k++; } b[i] = n-k-1; } for (int i = 0; i < n; i++) { b[i] = b[i] - (n-i) + 1; b[i]++; } long long ans = 1; for (int i = 0; i < n; i++) { ans *= max(b[i], 1); ans %= MOD; } cout << ans << endl; 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...