Submission #516251

#TimeUsernameProblemLanguageResultExecution timeMemory
516251EvangA Huge Tower (CEOI10_tower)C++17
100 / 100
139 ms2636 KiB
#include <bits/stdc++.h> using namespace std; const int mod = 1e9+9; int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, d; cin >> n >> d; vector<int> a(n); for(int i = 0; i < n; ++i) cin >> a[i]; sort(begin(a), end(a)); int p = 0; long long ans = 1; for(int i = 0; i < n; ++i){ while(a[p]+d<a[i]) ++p; ans = ans * (i-p+1)%mod; } cout << ans; }
#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...