Submission #600278

#TimeUsernameProblemLanguageResultExecution timeMemory
600278StormersyleA Huge Tower (CEOI10_tower)C++14
100 / 100
286 ms18656 KiB
#include <iostream> #include <bits/stdc++.h> #include <fstream> #include <string> #include <cstdio> #include <cstring> #include <algorithm> #include <math.h> #include <numeric> using namespace std; using ll=long long; using ull=unsigned long long; vector<int> a={-1}; int N, D, w; ll E=1000000009; ll f(int i){ if (i==1) return 1; int u=lower_bound(a.begin()+1, a.begin()+i, a[i]-D)-a.begin(); int b=i-u; return ((ll)(1+b)*(ll)(f(i-1)))%E; } int main() { // ifstream cin("file.in"); cin>>N>>D; for (int i=1; i<=N; i++){ cin>>w; a.push_back(w); } sort(a.begin(), a.end()); cout<<f(N); }
#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...