Submission #588524

# Submission time Handle Problem Language Result Execution time Memory
588524 2022-07-03T13:06:58 Z web Global Warming (CEOI18_glo) C++17
0 / 100
88 ms 3748 KB
#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

glo.cpp: In function 'long int lenLIS(std::vector<int>&)':
glo.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i=1; i<v.size(); ++i)
      |                  ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 3748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1116 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 2024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -