Submission #652696

#TimeUsernameProblemLanguageResultExecution timeMemory
652696kavnwangA Huge Tower (CEOI10_tower)C++14
30 / 100
278 ms5128 KiB
#include <bits/stdc++.h> using namespace std; 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 * (count[i] % (long long int) 10000000009) % (long long int) 10000000009); } 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...