Submission #652697

#TimeUsernameProblemLanguageResultExecution timeMemory
652697kavnwangA Huge Tower (CEOI10_tower)C++14
100 / 100
266 ms10496 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 9; int main() { int n, d; cin >> n >> d; int arr[n]; for(int i = 0;i<n;i++) { cin >> arr[i]; } sort(arr,arr+n); int count[n]; long long int ans = 1; int left = 0; int right = 0; while(left <= right) { while(right < n && arr[right] - arr[left] <=d) { count[right] = right - left+1; right++; } left++; } for(int i =0;i<n;i++) { ans = (ans * 1LL * count[i]) % MOD; } cout << ans << endl; 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...