Submission #884333

#TimeUsernameProblemLanguageResultExecution timeMemory
884333AndreiBOTOA Huge Tower (CEOI10_tower)C++14
100 / 100
235 ms18012 KiB
#include <iostream> #include <vector> #include <bits/stdc++.h> using namespace std; const int NMAX=1e6+5; const int MOD=1e9+9; #define int long long vector<int>v; int best[NMAX]; signed main() { int n,d,i,j; long long ans=1; cin>>n>>d; for(i=0;i<n;i++) { int x; cin>>x; v.push_back(x); } sort(v.begin(),v.end()); for(i=0;i<n;i++) best[i]=upper_bound(v.begin(),v.end(),v[i]+d)-v.begin(); for(i=0;i<n;i++) { ans*=(1LL*best[i]-i); ans%=MOD; } cout<<ans; return 0; }

Compilation message (stderr)

tower.cpp: In function 'int main()':
tower.cpp:16:15: warning: unused variable 'j' [-Wunused-variable]
   16 |     int n,d,i,j;
      |               ^
#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...