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 lis(vector<int>& arr)
{
vector<int> ans;
int n = arr.size();
for (int i = 0; i < n; i++) {
auto it
= lower_bound(ans.begin(), ans.end(), arr[i]);
if (it == ans.end()) {
ans.push_back(arr[i]);
}
else {
*it = arr[i];
}
}
return ans.size();
}
int main()
{
int n,x,a;
cin>>n>>x;
int q=n;
vector<int>v;
while(q--){
cin>>a;
v.push_back(a);
}
cout<<lis(v);
}
# | 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... |