Submission #719668

#TimeUsernameProblemLanguageResultExecution timeMemory
719668TAhmed33A Huge Tower (CEOI10_tower)C++98
5 / 100
349 ms89476 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int MOD = 1e9 + 9; int fact[10000001] = {}; int arr[10000000]; signed main () { fact[0] = 1; int n, d; for (int i = 1; i <= 10000000; i++) { fact[i] = (i * fact[i - 1]) % MOD; } cin >> n >> d; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); int l = 1; for (int i = 0; i < n; i++) { int ub = upper_bound(arr, arr + n, arr[i] + d) - arr; ub--; if (ub < i) continue; l = (l * fact[(ub - i + 1)]) % MOD; i = ub; } cout << l << '\n'; }
#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...