Submission #879251

#TimeUsernameProblemLanguageResultExecution timeMemory
879251theghostkingA Huge Tower (CEOI10_tower)C++17
100 / 100
234 ms16192 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int n,d; cin >> n >> d; int arr[n]; for (int i = 0; i<n; i++){ cin >> arr[i]; } sort(arr,arr+n); int nxt[n]; for (int i = 0; i<n; i++){ auto it = upper_bound(arr,arr+n,arr[i]+d); nxt[i] = (it-arr)-i; } const int MOD = 1e9+9; int ans = 1; for (int i = 0; i<n; i++){ //cout << nxt[i] << " "; ans *= nxt[i]; ans %= MOD; } //cout << "\n\n"; cout << ans; 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...