Submission #513902

#TimeUsernameProblemLanguageResultExecution timeMemory
513902heroeschargeA Huge Tower (CEOI10_tower)C++14
100 / 100
267 ms10632 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--; } long long int prod = 1; int M = 1000000009; long long int p; for (int i = 0; i < N; i++) { p = prod * (vals[i] % M); prod = p % 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...