Submission #858205

#TimeUsernameProblemLanguageResultExecution timeMemory
858205abeotA Huge Tower (CEOI10_tower)C++14
100 / 100
110 ms8856 KiB
// Source: https://usaco.guide/general/io #include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 9; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int d; cin >> d; int a[n]; for (int i = 0; i < n; ++i) cin >> a[i]; sort(a, a+n); int l = 0; long long ans = 1; for (int i = 1; i < n; ++i) { while (a[i] - a[l] > d) l++; int choices = i - l + 1; ans = ans * choices; ans %= MOD; } cout << ans << "\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...