Submission #499238

#TimeUsernameProblemLanguageResultExecution timeMemory
499238imaginary_unitA Huge Tower (CEOI10_tower)C++17
100 / 100
269 ms8748 KiB
#include <bits/stdc++.h> #define ll long long #define fi first #define se second using namespace std; const int MOD=1e9+9; int main() { //freopen("truth.in", "r", stdin); //freopen("truth.out", "w", stdout); int n, d; cin >> n >> d; int a[n]; for(int i=0; i<n; i++){ cin >> a[i]; } sort(a, a+n); int r=0, ans=1; for(int l=0; l<n; l++){ while(r<n-1 && a[r+1]-a[l]<=d){ r++; } int dist=r-l+1; ans=(ans*1LL*dist)%MOD; } 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...