Submission #867714

#TimeUsernameProblemLanguageResultExecution timeMemory
867714CookieA Huge Tower (CEOI10_tower)C++14
100 / 100
92 ms8896 KiB
#include<bits/stdc++.h> #include<fstream> using namespace std; ifstream fin("XMAS.INP"); ofstream fout("XMAS.OUT"); #define sz(a) (int)a.size() #define ll long long #define pb push_back #define forr(i, a, b) for(int i = a; i < b; i++) #define dorr(i, a, b) for(int i = a; i >= b; i--) #define ld long double #define vt vector #include<fstream> #define fi first #define se second #define pll pair<ll, ll> #define pii pair<int, int> const ld PI = 3.14159265359; //using u128 = __uint128_t; //const int x[4] = {1, -1, 0, 0}; //const int y[4] = {0, 0, 1, -1}; const ll mod = 1e9 + 9; const int mxn = 2e5 + 5, mxq = 2e5 + 5, sq = 500, mxv = 1e3 + 5; const ll inf = 1e17 + 5; //const int base= (1 << 18); mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, d; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> d; vt<int>v(n); forr(i, 0, n)cin >> v[i]; sort(v.begin(), v.end()); ll ans = 1; int l = 0; for(int i = 0; i < n; i++){ while(v[i] - v[l] > d)l++; ans = (ans * 1LL * (i - l + 1)) % mod; } cout << ans; 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...