Submission #928521

#TimeUsernameProblemLanguageResultExecution timeMemory
928521daodaA Huge Tower (CEOI10_tower)C++17
100 / 100
95 ms15440 KiB
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> #include <queue> #include <cmath> #include <cstring> #include <iomanip> #include <numeric> #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define FOR(a, b) for(ll i=a; i < (ll) b; i++) #define endl '\n' #define MOD (ll) 1000000009ll #define TESTCASE ll t; cin >> t; for(ll T=0; T < t; T++) using namespace std; typedef long long int ll; typedef vector<ll> vll; typedef pair<ll,ll> pll; typedef vector<pll> vpll; typedef vector<bool> vb; typedef vector<char> vc; typedef vector<int> vi; typedef pair<int, int> pi; typedef vector<pi> vpi; const ll INIT = 7; const ll MAX_VAL = (ll) 1e9; const ll MULT = (ll) 1e11; const double eps = 1e-5; vi rd = {0, 0 , 1, -1}, cd = {1, -1, 0 , 0}; int main() { fast // freopen(".in", "r", stdin); // freopen(".out", "w", stdout); // TESTCASE { // } ll n, d; cin >> n >> d; vll blocks(n + 1); FOR(1, n + 1) cin >> blocks[i]; sort(blocks.begin(), blocks.end()); vll tr(n + 1, 1); ll p=1, ans=1; FOR(1, n + 1) { while(blocks[p] + d < blocks[i]) p++; ans = (ans * (i - p + 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...