# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
144166 | Swan | Global Warming (CEOI18_glo) | C++14 | 41 ms | 5608 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 <bits/stdc++.h>
#define stop system("pause")
#define INP freopen("input.txt","r",stdin)
#define OUTP freopen("solve1.txt","w",stdout)
using namespace std;
typedef long long ll;
const int maxn = 200123;
ll dp[maxn];
void clean(int mx){
dp[0] = -1e16;
for(int i(1);i <=mx;i++)dp[i] = 1e16;
}
int get_lis(vector<ll>& v){
clean(v.size());
int ans = 0;
for(int i(0); i < v.size();i++){
int mx = upper_bound(dp,dp+i+1,v[i])-dp;
if(mx!=1 && v[mx-1] >= v[i])continue;
dp[mx] = min(dp[mx],v[i]);
ans = max(ans,mx);
}
return ans;
}
main()
{
ios_base::sync_with_stdio(0);
ll n,x; cin >> n >> x;
vector<ll> v;
for(int i(0); i < n;i++){
int w; cin >> w;
v.push_back(w);
}
cout << get_lis(v);
return 0;
}
/*
6 2
1 2 1 3 2 1
1
0
*/
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... |