Submission #876055

# Submission time Handle Problem Language Result Execution time Memory
876055 2023-11-21T07:36:29 Z tinnhiemnn Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 2392 KB
#include <bits/stdc++.h>
using namespace std;
#define file "file"
const long long N=2e5+5;
long long n,M,i,j,res,b[N],f[N];
int main()
{
    //freopen(file".inp", "r", stdin);
    //freopen(file".out", "w", stdout);
    ios_base::sync_with_stdio(); cin.tie();

    cin>>n>>M;
    for (i=1;i<=n;i++)
    {
        cin>>j; b[i]=max(0ll, M*i-j);
    }

    for (i=1;i<=n;i++)
    {
        if (b[i]>=f[res]) {res++; f[res]=b[i]; continue;}

        j=upper_bound(f+1, f+res+1, b[i]) - f;
        f[j]=b[i];
    }

    cout<<n-res;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -