Submission #886580

#TimeUsernameProblemLanguageResultExecution timeMemory
886580stefanneaguA Huge Tower (CEOI10_tower)C++17
100 / 100
109 ms12768 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int nmax = 2e6 + 1, mod = 1e9 + 9; int v[nmax]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); int n, h; cin >> n >> h; for(int i = 1; i <= n; i ++) { cin >> v[i]; } sort(v + 1, v + n + 1); int ult = 1, ans = 1; for(int i = 2; i <= n; i ++) { while(v[i] - v[ult] > h) { ult ++; } ans *= i - ult + 1; ans %= mod; } 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...