Submission #672361

#TimeUsernameProblemLanguageResultExecution timeMemory
672361scrgeA Huge Tower (CEOI10_tower)C++17
100 / 100
254 ms10500 KiB
#include <bits/stdc++.h> #define int long long #define MOD (int) 1e9+9 using namespace std; int n, d; vector<int> a; signed main(){ cin >> n >> d; a.resize(n); for(int i = 0; i < n; i++) cin >> a[i]; sort(a.rbegin(), a.rend()); int j = 0; int ans = 1; for(int i = 0; i < n; i++){ while(j+1 < n && a[j+1]+d >= a[i]) j++; ans *= j+1-i; ans %= 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...