Submission #524055

#TimeUsernameProblemLanguageResultExecution timeMemory
524055K4YANA Huge Tower (CEOI10_tower)C++17
100 / 100
137 ms14020 KiB
//Be Name Khoda #include<bits/stdc++.h> #pragma GCC optimize("Ofast,unroll-loops") using namespace std; #define ll long long #define ld long double #define all(x) x.begin(), x.end() #define pii pair<int, int> #define pll pair<ll, ll> const ll mxn = 2e5 + 16, md = 1e9 + 9; ll t, n, D, q, w; vector<ll> g; vector<pll> f; void input() { g.clear(), f.clear(); cin >> n >> D; for(int i = 0; i < n; i++) { cin >> q; g.push_back(q); } } void solve() { sort(all(g)); ll ans = 1, ptr = 0; for(ll i = 1; i < n; i++) { while(g[ptr] < g[i] - D) { ptr++; } ans = ans * (i - ptr + 1) % md; } cout << ans << endl; return; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); input(), 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...