Submission #954445

#TimeUsernameProblemLanguageResultExecution timeMemory
954445thiago_bastosA Huge Tower (CEOI10_tower)C++17
100 / 100
97 ms9004 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 9; void solve() { int n, d; cin >> n >> d; vector<int> a(n); int answer = 1, lo = 0; for(int& v : a) cin >> v; sort(a.begin(), a.end()); for(int i = 0; i < n; ++i) { while(a[lo] < a[i] - d) ++lo; answer = (i - lo + 1ll) * answer % MOD; } cout << answer << '\n'; } int main() { int t = 1; ios_base :: sync_with_stdio(false); cin.tie(0); //cin >> t; while(t--) solve(); 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...