# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
798002 | iloveroseanne | Rabbit Carrot (LMIO19_triusis) | C++14 | 1 ms | 212 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.
/// PARK CHAEYOUNG IS MY LOVE
/// Author: Ngo Ba Van
/// roses_are_rosie
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define fi first
#define se second
#define MASK(i) (1LL<<i)
#define BIT(x,i) (x&MASK(i))
#define ONBIT(x,i) (x|MASK(i))
#define OFFBIT(x,i) (x&~MASK(i))
#define COUNT(x) (__builtin_popcount(x))
using ii=pair<int,int>;
const ll N=2e5+5,M=1e9+7;
ll n,m,res,a[N];
vector<int>dp;
void nhap()
{
cin>>n>>m;
for (int i=1;i<=n;i++)
{
int x;
cin>>x;
a[i]=m*i-x;
}
for (int i=1;i<=n;i++)
{
if (dp.empty()||a[i]>=dp.back()) dp.push_back(a[i]);
else
*lower_bound(dp.begin(),dp.end(),a[i])=a[i];
}
cout<<n-dp.size();
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#define task ""
#define task "a"
if(fopen(task".inp","r"))
{
freopen(task".inp","r",stdin);
freopen(task".out","w",stdout);
}
int t=1;
//cin>>t;
while (t--)
nhap();
}
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... |