제출 #513901

#제출 시각아이디문제언어결과실행 시간메모리
513901heroeschargeA Huge Tower (CEOI10_tower)C++14
30 / 100
293 ms11188 KiB
#include <iostream> #include <fstream> #include <algorithm> using namespace std; int N, D; int f(int arr[]) { int p1loc = 0; int p1val = 0; int p2loc = 0; int vals[N]; while (p2loc < N) { while (arr[p1loc] <= arr[p2loc] + D && p1loc < N) { p1loc++; p1val++; } vals[p2loc] = p1val; p2loc++; p1val--; } int prod = 1; int M = 1000000009; for (int i = 0; i < N; i++) { prod = (prod * (vals[i] % M)) % M; } return prod; } int main() { cin >> N >> D; int arr[N]; for (int i = 0; i < N; i++) { cin >> arr[i]; } sort(arr, arr + N); cout << f(arr); }
#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...