Submission #634719

#TimeUsernameProblemLanguageResultExecution timeMemory
634719iulia13A Huge Tower (CEOI10_tower)C++14
100 / 100
260 ms8776 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int MOD = 1e9 + 9; const int N = 1e6 + 5; int v[N]; ll ans = 1; int main() { int n, d; cin >> n >> d; for (int i = 1; i <= n; i++) cin >> v[i]; sort(v + 1, v + n + 1); int j = 1; ans = 1; for (int i = 2; i <= n; i++) { while (j < i && v[j] + d < v[i]) j++; ans = ans * (1ll *(i - j + 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...