Submission #926580

#TimeUsernameProblemLanguageResultExecution timeMemory
926580AiperiiiRabbit Carrot (LMIO19_triusis)C++14
100 / 100
78 ms5524 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define all(x) x.begin(),x.end() #define pb push_back using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n,m; cin>>n>>m; vector <int> a(n); for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<n;i++){ a[i]-=(i+1)*m; } reverse(all(a)); vector <int> v(n+1,1e18); v[0]=-1e18; for(int i=0;i<n;i++){ auto pos=upper_bound(all(v),a[i])-v.begin(); v[pos]=a[i]; } auto pos=upper_bound(all(v),0ll)-v.begin(); cout<<n+1-pos<<"\n"; } /* 5 400 300 700 200 1000 500 3 300 700 1000 1300 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...