Submission #856863

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