Submission #710063

#TimeUsernameProblemLanguageResultExecution timeMemory
710063mmaitiA Huge Tower (CEOI10_tower)C++11
100 / 100
277 ms8796 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 9; int main() { int N, D; cin >> N >> D; vector<int> arr(N); for(int i = 0; i < N; i++) cin >> arr[i]; sort(arr.begin(), arr.end()); int sol = 1, r = 0; for(int l = 0; l < N; l++) { while(r < N - 1 && arr[r+1] <= arr[l] + D) r++; int dist = r - l + 1; sol = (sol * 1LL * dist) % MOD; } cout << sol; }
#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...