Submission #417825

#TimeUsernameProblemLanguageResultExecution timeMemory
417825NghesA Huge Tower (CEOI10_tower)C++14
100 / 100
146 ms10556 KiB
#include <bits/stdc++.h> using namespace std; typedef int64_t ll; #define E '\n' #define name "main" #define int ll const int base = 1e9+9; const int N = 1e6; int a[N+13]; int n,k; signed main(){ ios::sync_with_stdio(0); cin . tie(0); //freopen(name".INP","r",stdin); freopen(name".OUT","w",stdout); cin >> n >> k; for (int i=1; i <= n ; ++i) cin >>a[i]; sort(a+1,a+1+n,greater<int>()); int res = 1; for (int r =1,l=1; r <= n ; ++r){ while (a[l] - a[r] > k) ++l; res = res * (r-l+1) % base; } cout << res << E; }
#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...