Submission #973293

#TimeUsernameProblemLanguageResultExecution timeMemory
973293jadai007A Huge Tower (CEOI10_tower)C++17
100 / 100
107 ms10744 KiB
#include<bits/stdc++.h> #define int long long using namespace std; const int mod = 1e9 + 9; int n, d, ans = 1; vector<int> vc, dp; int32_t main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> n >> d; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr+n); for (int i = 1; i < n; i++){ int l = 0, r = i; while (l < r){ int mid = (l+r)/2; if (arr[mid]+d >= arr[i]) r = mid; else l = mid+1; } int cnt = i-l; ans = ((ans%mod)*((cnt+1)%mod))%mod; } cout << ans; }
#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...