Submission #856864

#TimeUsernameProblemLanguageResultExecution timeMemory
856864Euclid73A Huge Tower (CEOI10_tower)C++17
100 / 100
204 ms10504 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const ll MOD=1e9+9; int main() { ll n, d; cin >> n >> d; ll a[n]; for (int i=0; i<n; i++) { cin >> a[i]; } sort(a, a+n); ll r=0, ans=1; for (ll i=0; i<n; i++) { while (r+1<n && a[r+1]<=a[i]+d) { r++; } ans=ans*(r-i+1); ans=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...