#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fr first
#define se second
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = a; i > (b); --i)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define IN(i,l,r) (l<i&&i<r)
#define pb push_back
#define ones __builtin_popcountll
using namespace std;
using namespace __gnu_pbds;
template <class T>
using OSTree = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef long long ll;
int n,m;
vi A;
int lis(vi& a){
vi dp;
for(int v:a){
int pos = upper_bound(all(dp),v) - dp.begin();
if(pos == sz(dp)) dp.push_back(v);
else dp[pos] = v;
}
return sz(dp);
}
int main(){
cin.tie(0)->sync_with_stdio(false);
cin >> n >> m;
A = vi(n+1);
A[0] = 0;
rep(i,1,n+1){
cin >> A[i];
A[i] -= i*m;
}
cout << lis(A)-1 << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |