Submission #797214

#TimeUsernameProblemLanguageResultExecution timeMemory
797214yusuf12360Rabbit Carrot (LMIO19_triusis)C++14
100 / 100
26 ms4816 KiB
#include<bits/stdc++.h> #define int long long using namespace std; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector<int> a(n), dp; for(int &p : a) cin >> p; for(int i=0; i<n; i++) { int p=m*(i+1)-a[i]; if(p<0) continue; auto it=lower_bound(dp.begin(), dp.end(), p); if(it==dp.end()) dp.push_back(p-1); else *it=p-1; } cout << n-(int)dp.size() << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...