Submission #273828

#TimeUsernameProblemLanguageResultExecution timeMemory
273828shrek12357A Huge Tower (CEOI10_tower)C++14
100 / 100
604 ms8796 KiB
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <climits> #include <cmath> #include <fstream> #include <queue> using namespace std; #define MOD 1000000009 int main() { int n, d; cin >> n >> d; vector<long long> nums; //map<long long, long long> indexes; for (int i = 0; i < n; i++) { int temp; cin >> temp; nums.push_back(temp); } sort(nums.begin(), nums.end()); long long dp = 1; //set<long long> curNums; //set<long long>::iterator it; vector<long long>::iterator it1; //curNums.insert(nums[0]); //indexes[nums[0]] = 0; int lol = 0; for (int i = 1; i < n; i++) { it1 = lower_bound(nums.begin(), nums.begin() + i, nums[i] - d); if (it1 == nums.end()) { lol++; } else { dp = (dp * (i - (it1 - nums.begin()) + 1)) % MOD; } } cout << dp << 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...