Submission #497496

#TimeUsernameProblemLanguageResultExecution timeMemory
497496mehdi_farhadianA Huge Tower (CEOI10_tower)C++17
100 / 100
126 ms8732 KiB
#include <bits/stdc++.h> #define pb push_back #define endl '\n' #pragma GCC optimize("unroll-loops") #pragma GCC optimize("Ofast") #pragma GCC optimize("O0") #pragma GCC optimize("O1") using namespace std; typedef long long ll; const int mod = 1e9 + 9; int n, k; vector<int> vec; void solve() { ll res = 1; for (int i = 0; i < n; i++) { int tmp = vec[i] - k - 1; int ind = upper_bound(vec.begin(), vec.end(), tmp) - vec.begin(); res *= i - ind + 1; res %= mod; } cout << res << endl; } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> k; vec.resize(n); for (int i = 0; i < n; i++) { cin >> vec[i]; } sort(vec.begin(), vec.end()); solve(); }
#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...