Submission #573484

#TimeUsernameProblemLanguageResultExecution timeMemory
573484lamA Huge Tower (CEOI10_tower)C++17
100 / 100
122 ms14028 KiB
#include <bits/stdc++.h> #define taskname "truth" #define int long long #define maxn 110 using namespace std; int n,d; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); // freopen(taskname".in","r",stdin); // freopen(taskname".out","w",stdout); cin>>n>>d; vector <int> a; for (int i=1; i<=n; i++) { int x; cin>>x; a.push_back(x); } sort(a.begin(),a.end()); int r=0; int ans=1ll; int mod=1e9+9; for (int l=0; l<n; l++) { while (r<n-1&&a[r+1]-a[l]<=d) r++; int temp=r-l+1; ans=(ans*temp)%mod; } cout<<ans; }
#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...