Submission #553576

#TimeUsernameProblemLanguageResultExecution timeMemory
5535761BeeNY1A Huge Tower (CEOI10_tower)C++17
100 / 100
297 ms8148 KiB
#include <bits/stdc++.h> using namespace std; int n,d,v[1000005]; const int mod=1000000009; int main() { cin>>n>>d; for(int i=1; i<=n; i++) cin>>v[i]; sort(v+1,v+n+1); int ways=1,pos=1; for(int i=2; i<=n; i++) { while(pos<i&&v[pos]+d<v[i]) pos++; ways=(long long)ways*(i-pos+1)%mod; } cout<<ways; 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...