# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097022 | ivaziva | Rabbit Carrot (LMIO19_triusis) | C++14 | 56 ms | 4300 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;
#define MAXN 200001
int n,m;
int a[MAXN];
vector<int> dp;
int main()
{
cin>>n>>m;
for (int i=1;i<=n;i++) cin>>a[i];
for (int i=0;i<=n;i++) a[i]+=m*(n-i);
for (int i=0;i<=n;i++) a[i]=a[i]*(-1);
dp.push_back(a[0]);
for (int i=1;i<=n;i++)
{
int pos=upper_bound(dp.begin(),dp.end(),a[i])-dp.begin();
if (pos==dp.size()) dp.push_back(a[i]);
else if (pos==0) continue;
else dp[pos]=a[i];
}
cout<<n+1-dp.size()<<endl;
}
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... |