Submission #998038

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

int v[200001];
int n;

int caut(int a){
    int st,dr,mij,rasp;
    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;
}

int main() {
    int d,max1=-1,a,i,aux;
    cin>>n>>d;
    for(i=0;i<=n;i++) v[i]=1e9;
    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;
}

Compilation message

triusis.cpp: In function 'int caut(int)':
triusis.cpp:16:12: warning: 'rasp' may be used uninitialized in this function [-Wmaybe-uninitialized]
   16 |     return rasp;
      |            ^~~~
triusis.cpp: In function 'int main()':
triusis.cpp:8:19: warning: 'rasp' may be used uninitialized in this function [-Wmaybe-uninitialized]
    8 |     int st,dr,mij,rasp;
      |                   ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -