Submission #404567

#TimeUsernameProblemLanguageResultExecution timeMemory
404567HadiHosseiniA Huge Tower (CEOI10_tower)C++14
100 / 100
140 ms11204 KiB
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 9; int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, d; cin >> n >> d; vector<long long> v(n); for(int i = 0 ; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); long long ans = 1; int j = 0; for(int i = 0 ; i < n; i++){ while(v[i] > v[j] + d) j++; ans *= (i - j + 1); ans %= mod; } cout << ans << "\n"; 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...