Submission #884328

#TimeUsernameProblemLanguageResultExecution timeMemory
884328AndreiBOTOA Huge Tower (CEOI10_tower)C++14
30 / 100
209 ms13040 KiB
#include <iostream> #include <vector> #include <bits/stdc++.h> using namespace std; const int NMAX=1e6+5; const int MOD=1e9+7; #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*=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...