# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
588524 | web | Global Warming (CEOI18_glo) | C++17 | 88 ms | 3748 KiB |
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 <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
long lenLIS(vector<int>& v)
{
vector<int> lisEnds (v.size(), 0);
lisEnds[0] = v[0];
int currLen = 1;
for(int i=1; i<v.size(); ++i)
{
if(v[i] < lisEnds[0])
{
lisEnds[0] = v[i];
}
else if(v[i] > lisEnds[currLen-1])
{
currLen++;
lisEnds[currLen-1] = v[i];
} else
{
//find where we gotta add it
auto lowB = lower_bound(lisEnds.begin(), lisEnds.begin() + currLen, v[i]);
lowB--;
lisEnds[lowB-lisEnds.begin()] = v[i];
}
}
return currLen;
}
int main()
{
long n, x; cin>>n>>x;
vector<int> t(n);
for(int i =0; i<n; ++i)
cin>>t[i];
cout<<lenLIS(t)<<endl;
}
Compilation message (stderr)
# | 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... |