Submission #135475

#TimeUsernameProblemLanguageResultExecution timeMemory
135475imeimi2000A Huge Tower (CEOI10_tower)C++17
100 / 100
177 ms3576 KiB
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long llong; const int mod = 1e9 + 9; int n, d; int A[1000000]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> d; for (int i = 0; i < n; ++i) { cin >> A[i]; } sort(A, A + n); int ans = 1; for (int i = 0; i < n; ++i) { int x = lower_bound(A, A + n, A[i] - d) - A; ans = ans * (i + 1ll - x) % mod; } printf("%d\n", 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...