Submission #419946

#TimeUsernameProblemLanguageResultExecution timeMemory
419946HaidaraA Huge Tower (CEOI10_tower)C++17
85 / 100
1098 ms5068 KiB
/* ID: haidara LANG: C++17 PROB: diamond */ #include<bits/stdc++.h> #pragma GCC optimize("O1") #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define int long long #define rep(i,x,n) for(int i=x;i<n;i++) #define FOR(i,n) rep(i,0,n) #define per(i,x,n) for(int i=x;i>n;i--) #define ROF(i,x) for(int i=x;i>=0;i--) #define v(i) vector< i > #define p(i,j) pair< i , j > #define pii pair<int,int> #define m(i,j) map< i , j > #define pq(i) priority_queue< i > #define ff first #define all(x) x.begin(),x.end() #define ss second #define pp push_back using namespace std; const int inf=1LL<<62LL; const int mod=1e9+9; const int maxn=200200; signed main() { //freopen("diamond.in","r",stdin); //freopen("diamond.out","w",stdout); fast; int n,d; cin>>n>>d; v(int)a(n); FOR(i,n)cin>>a[i]; sort(a.begin(),a.end()); int r=0,sol=1,inx=0; FOR(i,n) { FOR(j,100000) inx++; while(r<n-1&&a[r+1]-a[i]<=d) r++; sol=(sol*(r-i+1))%mod; } cout<<sol; }
#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...