Submission #998042

# Submission time Handle Problem Language Result Execution time Memory
998042 2024-06-13T08:44:20 Z Petrix Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1000 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-1;
    while(st<=dr){
        mij=(st+dr)/2;
        if(v[mij]>a){
            rasp=mij;st=mij-1;
        }else dr=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;
        if(a>0) continue;
        a=-a;
        aux=caut(a);
        v[aux]=a;max1=max(max1,aux);
    }
    cout<<n-1-max1;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -