Submission #336771

#TimeUsernameProblemLanguageResultExecution timeMemory
336771StormersyleA Huge Tower (CEOI10_tower)C++14
100 / 100
333 ms16288 KiB
#include <iostream> #include <bits/stdc++.h> #include <array> #include <fstream> #include <string> #include <algorithm> #include <cmath> #include <sstream> using namespace std; using ll=long long; int main() { int N; ll D, w; // ifstream cin("file.in"); cin>>N>>D; vector<ll> a; for (int i=0; i<N; i++) cin>>w, a.push_back(w); sort(a.begin(), a.end(), greater<ll>()); ll c[N+1]; auto it1=a.begin(); for (int x=N; x>=2; x--){ auto it=upper_bound(a.begin(), a.end(), a[N-x]-D, greater<ll>()); c[x]=it-it1; it1++; // cout<<it-a.begin()<<" "<<it1-a.begin()<<"\n"; // cout<<c[x]; } ll T=1, z=1000000009; for (int i=2; i<=N; i++) T= (T*c[i])%z; cout<<T; }
#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...