Submission #535147

#TimeUsernameProblemLanguageResultExecution timeMemory
535147andecaandeciA Huge Tower (CEOI10_tower)C++17
100 / 100
299 ms8744 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 9; int main(){ int n,d; cin >> n >> d; int arr[n+5]; for(int i=0;i<n;i++){ cin >> arr[i]; } sort(arr,arr+n); int r = 0, sol = 1; for (int l = 0; l < n; l++) { while (r < n - 1 && arr[r + 1] - arr[l] <= d) r++; int dist = r - l + 1; sol = (sol * 1LL * dist) % MOD; } cout << sol << '\n'; 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...