This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |