#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;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |