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;
#define int long long
int32_t main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, x;
cin >> n >> x;
vector<int> v(n, 0);
for(int i = 0;i<n;i++) {
int p;
cin >> p;
v[i] = p;
}
int dp[n], MAX = 0;
dp[0] = 1;
for(int i = 1;i<n;i++) {
dp[i] = 1;
for(int j = 0;j<i;j++) {
if(v[j] <= v[i] and dp[j] +1 > dp[i]) {
dp[i] = dp[j] + 1;
}
MAX = max(dp[i], MAX);
}
}
cout<<MAX<<endl;
}
# | 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... |