Submission #1125779

#TimeUsernameProblemLanguageResultExecution timeMemory
1125779erentor353A Huge Tower (CEOI10_tower)C++20
95 / 100
41 ms2628 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; template<typename T> using oset = __gnu_pbds::tree<T, __gnu_pbds::null_type, greater<T>, __gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>; #define vt vector #define uset unordered_set #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) (int)x.size() #define ll long long #define ull unsigned ll #define ld long double #define okey order_of_key #define oget find_by_order #define gcf(x, y) __gcd(x, y) #define bits(x) __builtin_popcount(x) typedef vt<int> vi; typedef pair<int,int> pi; typedef pair<ll, ll> pll; const ll MAXN = 3e5; const ll MAXM = 60; const ll MAXL = 33; const ll MOD = 1e9 + 9; ll N, D, a[MAXN]; void solve(){ cin>>N>>D; for(int i = 0; i<N; ++i){ cin>>a[i]; } sort(a, a+N); ll prod = 1; int lo = 0; for(int i = 0; i<N; ++i){ while(a[i] - a[lo] > D) ++lo; prod *= i-lo+1; prod %= MOD; } cout<<prod<<"\n"; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; //cin>>t; while(t--) 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...