Submission #697456

#TimeUsernameProblemLanguageResultExecution timeMemory
697456Markomafko972A Huge Tower (CEOI10_tower)C++14
100 / 100
114 ms9824 KiB
#include <bits/stdc++.h> #define X first #define Y second #define pb push_back #define pii pair<int, int> typedef long long ll; using namespace std; const int MOD = 1e9 + 9; const ll INF = 1e18; const int OFF = (1 << 20); int n, d, a; vector<int> v; int mul(int x, int y) { return (ll)x * (ll)y % MOD; } int main () { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> d; for (int i = 0; i < n; i++) { cin >> a; v.push_back(a); } sort(v.begin(), v.end()); int sol = 1; int p = 0; for (int i = 1; i < n; i++) { while (v[p]+d < v[i]) p++; sol = mul(sol, i-p+1); } cout << sol; 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...