Submission #439522

#TimeUsernameProblemLanguageResultExecution timeMemory
439522s_jaskaran_sA Huge Tower (CEOI10_tower)C++17
100 / 100
165 ms8732 KiB
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n,d; cin>>n>>d; vector<int> a(n); for(int i=0;i<n;i++){ cin>>a[i]; } ll ans=1; sort(a.rbegin(),a.rend()); int j=0; for(int i=0;i<n;i++){ if(a[i]-a[j]<=d&&j<n){ j++; i--; } else{ ans=(ans*(j-i))%1000000009; } } cout<<ans; 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...