Submission #144166

# Submission time Handle Problem Language Result Execution time Memory
144166 2019-08-16T09:08:02 Z Swan Global Warming (CEOI18_glo) C++14
0 / 100
41 ms 5608 KB
#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

glo.cpp: In function 'int get_lis(std::vector<long long int>&)':
glo.cpp:19:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i(0); i < v.size();i++){
                   ~~^~~~~~~~~~
glo.cpp: At global scope:
glo.cpp:28:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 5608 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 1684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 3020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -