Submission #480203

#TimeUsernameProblemLanguageResultExecution timeMemory
480203mohamedsobhi777A Huge Tower (CEOI10_tower)C++14
90 / 100
31 ms4188 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; const int mod = 1e9 + 9 ; int n, d ; int a[N] ; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifndef ONLINE_JUDGE #endif cin >> n >> d ; for(int i = 1 ;i <= n; ++ i){ cin >> a[i] ; } sort(a + 1, a + n + 1) ; int j = 1; int ans = 1 ; for(int i = 1 ;i <= n;++ i){ while(a[i]-a[j]>d) ++ j; int len = i - j + 1; ans = 1ll * ans * len % 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...