Submission #998049

# Submission time Handle Problem Language Result Execution time Memory
998049 2024-06-13T08:52:23 Z Petrix Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 348 KB
#include<iostream>
using namespace std;

#define int long long

int v[200001];
int n;

int caut(int a){
    int st,dr,mij,rasp=-1;
    st=0;dr=n;
    while(st<=dr){
        mij=(st+dr)/2;
        if(v[mij]>a){
            rasp=mij;dr=mij-1;
        }else st=mij+1;
    }
    return rasp;
}

signed main() {
    int d,max1=-1,a,i,aux;
    cin>>n>>d;
    for(i=0;i<=n;i++) v[i]=1e18;
    for(i=1;i<=n;i++){
        cin>>a;
        a=i*d-a;
        if(a>0) continue;
        aux=caut(a);
        v[aux]=a;max1=max(max1,aux);
    }
    cout<<n-1-max1;
    return 0;
}

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