Submission #462239

#TimeUsernameProblemLanguageResultExecution timeMemory
462239AlexLuchianovA Huge Tower (CEOI10_tower)C++14
100 / 100
141 ms9860 KiB
#include <iostream> #include <vector> #include <algorithm> using ll = long long; int const modulo = 1000000009; int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); int n, d; std::cin >> n >> d; std::vector<int> v; for(int i = 1; i <= n; i++) { int aux; std::cin >> aux; v.push_back(aux); } std::sort(v.begin(), v.end()); int ptr = v.size() - 1; int result = 1; for(int i = v.size() - 2; 0 <= i; i--) { while(v[i] + d < v[ptr]) ptr--; result = 1LL * result * (ptr - i + 1) % modulo; } std::cout << result; 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...