이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[200005];
vector<int>f;
int lis[200005];
int main(){
cin>>n>>m;
f.push_back(0);
for (int i=1 ;i<=n; i++){
cin>>a[i];
if (a[i]<=m*i){
f.push_back(a[i]-m*i);
}
}
reverse(f.begin(), f.end());
int t=0;
for (auto v:f){
int k=upper_bound(lis+1, lis+1+t, v)-lis;
lis[k]=v;
t=max(t, k);
}
cout<<n+1-t;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |