This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll inf = (ll)1e10;
int main(){
fastIO;
int n;
ll x;
cin >> n >> x;
vector<ll> v(n);
for(int i = 0 ; i < n; i ++ ){
cin >> v[i];
}
ll ans = 0;
for(int k = 0 ; k <= n; k ++ ){
vector<ll> nw;
for(int y = 0; y < n ; y ++ ){
if(y < k)
nw.push_back(v[y]-x);
else
nw.push_back(v[y]);
}
vector<ll> dp(n);
for(int i = 0 ; i < n; i ++ ){
dp[i]=1;
for(int j = 0; j < i ; j ++ ){
if(nw[i]>nw[j])
dp[i]=max(dp[i],dp[j]+1);
}
ans=max(ans,dp[i]);
}
}
cout << ans;
return 0;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |