Submission #365065

#TimeUsernameProblemLanguageResultExecution timeMemory
365065horsefeedapplesA Huge Tower (CEOI10_tower)C++11
100 / 100
322 ms10732 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1e9+9; int main() { ll n, d; cin>>n>>d; ll arr[n]; for(ll i=0; i<n; i++){ cin>>arr[i]; } sort(arr, arr+n); ll l = 0, r = 0; ll sol = 1; for(; l<n; l++){ while(arr[l]+d>=arr[r+1] && r<n-1){ r++; } ll dist = r-l+1; sol = (sol*dist)%MOD; } cout<<(sol%MOD); }
#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...