Submission #677008

#TimeUsernameProblemLanguageResultExecution timeMemory
677008RadicaIRabbit Carrot (LMIO19_triusis)C++17
100 / 100
83 ms3896 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main(){ int n,t; cin >> n>>t; vector<int> dp; for(int i=1; i<=n; i++){ int x; cin >> x; int val = i*t-x; if(val<0) continue; if(dp.size()==0){ dp.push_back(val); }else if(val >= dp[dp.size()-1]) dp.push_back(val); else *upper_bound(dp.begin(), dp.end(), val) = val; }cout << n-dp.size(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...