제출 #1135380

#제출 시각아이디문제언어결과실행 시간메모리
1135380mnbvcxz123A Huge Tower (CEOI10_tower)C++20
100 / 100
181 ms2840 KiB
#include <algorithm> #include <iostream> #include <vector> using namespace std; const int MOD = 1e9 + 9; int main() { int n, d; cin >> n >> d; vector<int> ar(n); for (int i = 0; i < n; i++) { cin >> ar[i]; } sort(ar.begin(), ar.end()); int r = 0; int sol = 1; for (int l = 0; l < n; l++) { while (r < n - 1 && ar[r + 1] - ar[l] <= d) { r++; } int dist = r - l + 1; sol = (sol * 1LL * dist) % MOD; } cout << sol << endl; }
#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...