Submission #847679

#TimeUsernameProblemLanguageResultExecution timeMemory
847679handlenameA Huge Tower (CEOI10_tower)C++17
100 / 100
91 ms2704 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define float long double const int MOD=1e9+9; //const int MOD=998244353; const int sqn=450; const long double eps=1e-6; int n,d,arr[800001]; void runtc(){ cin>>n>>d; for (int i=1;i<=n;i++){ cin>>arr[i]; } sort(arr+1,arr+n+1); reverse(arr+1,arr+n+1); long long ans=1; int id=1; for (int i=1;i<=n;i++){ while (arr[id]>arr[i]+d) id++; ans*=i-id+1; ans%=MOD; } cout<<ans; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("snowboots.in","r",stdin); //freopen("snowboots.out","w",stdout); //freopen("input1.in","r",stdin); //freopen("output1.out","w",stdout); //freopen("perfectly_balanced_chapter_1_input.txt","r",stdin); //freopen("hackercup_output.txt","w",stdout); int tc; //cin>>tc; tc=1; for (int i=1;i<=tc;i++){ //cout<<"Case #"<<i<<": "; runtc(); } }
#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...