Submission #497204

#TimeUsernameProblemLanguageResultExecution timeMemory
497204MatBadA Huge Tower (CEOI10_tower)C++14
100 / 100
112 ms5156 KiB
#include<bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define ppb pop_back #define FOR(i,a,b) for(int i=a;i<=b;i++) #define FORR(i,a,b) for(int i=a;i>=b;i--) #define debug(x) cerr<<#x<<" : "<<x<<'\n' typedef long long ll; typedef long double ld; typedef pair<ll , ll> pii; typedef pair<ll , pii> piii; const ll MX=1e6+5, MOD=1e9+9, inf = 1e9+5; ll n, a[MX], d; int main(){ ios::sync_with_stdio(false);cin.tie(NULL); cin>>n>>d; FOR(i, 1, n) cin>>a[i]; sort(a+1, a+n+1); ll ans=1; int it=1; FOR(i, 2, n){ while(a[it]+d<a[i]) it++; ans = (ans*(i-it+1))%MOD; } cout<<ans<<'\n'; }
#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...