Submission #797144

#TimeUsernameProblemLanguageResultExecution timeMemory
797144yusuf12360Rabbit Carrot (LMIO19_triusis)C++14
0 / 100
1 ms212 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+1), dp; for(int i=n-1; i>=0; i--) cin >> a[i]; for(int i=0; i<=n; i++) { auto it=lower_bound(dp.begin(), dp.end(), a[i]+m); if(it==dp.end()) dp.push_back(a[i]); else *it=a[i]; } 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...