Submission #930475

#TimeUsernameProblemLanguageResultExecution timeMemory
930475Darren0724A Huge Tower (CEOI10_tower)C++17
100 / 100
92 ms11368 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define LCBorz ios_base::sync_with_stdio(false); cin.tie(0); #define all(x) x.begin(), x.end() const int N=200005; const int INF=1e18; const int mod=1e9+9; int32_t main() { LCBorz; int n,k;cin>>n>>k; vector<int> v(n+1); for(int i=0;i<n;i++){ cin>>v[i]; } v[n]=INF; sort(all(v)); int ans=1; for(int i=n-1,j=n-1;i>=0;i--){ while(j>=i&&v[j]>v[i]+k)j--; ans=ans*(j-i+1)%mod; } cout<<ans<<endl; 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...