# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1019350 | vjudge1 | Rabbit Carrot (LMIO19_triusis) | C++17 | 1 ms | 436 KiB |
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>
using namespace std;
int m,n,x=0;
int main() {
cin >> n >> m;
int a[n+1],b[n+1],dp[n];
for(int i =0; i < n; i++){
cin >> a[i];
b[i]=a[i]-(m*i)-m;
}
vector <int> ans;
if(b[0]>0){
b[0]=0;x++;
}
ans.push_back(b[0]);
for(int i = 1; i < n; i++){
for(int j : ans){
//cout << j << " ";
}
if(b[i]<=0){
if(b[i]<=ans.back()){
ans.push_back(b[i]);
}
else{
//cout << endl;
int p = lower_bound(ans.begin(),ans.end(),b[i],greater<int>())-ans.begin();
//cout << b[i] << " " << p << endl;
ans[p]=b[i];
}
}
//cout << endl << endl;
}
cout << x+n-ans.size();
}
Compilation message (stderr)
# | 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... |