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;
int main(){
int n, x;
cin >> n >> x;
int a[n];
for(int i = 0;i < n; i++) cin >> a[i];
if(x == 0){
vector<int> dp;
for(int i = 0; i < n; i++){
int idx = lower_bound(dp.begin(), dp.end(), a[i]) - dp.begin();
if(idx == (int)dp.size()){
dp.push_back(a[i]);
}
else{
dp[idx] = a[i];
}
}
cout << dp.size() << "\n";
}
}
# | 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... |