제출 #480204

#제출 시각아이디문제언어결과실행 시간메모리
480204mohamedsobhi777A Huge Tower (CEOI10_tower)C++14
100 / 100
147 ms8072 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e6 + 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...