Submission #540524

# Submission time Handle Problem Language Result Execution time Memory
540524 2022-03-20T16:32:55 Z juankipedia Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
0 ms 212 KB
# include <bits/stdc++.h>
using namespace std;
/*************************************************************************************/
# define endl "\n"
# define io_boost std::ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
typedef unsigned long long int ulli;
typedef long long int lli;
/*************************************JUANKIPEDIA*************************************/
const int MAXN = 200005;
int N;
lli a[MAXN], J;

int len, n;
int lis[MAXN];
    vector<lli> s;
int LIS(){
    len = 0;
    vector<int> l;
    int lis_len[MAXN], pos;
    for(int i = 0; i < n; i++){
        int j = upper_bound(l.begin(), l.end(), s[i]) - l.begin();
        if(j == l.size()) l.push_back(s[i]);
        else l[j] = s[i];
        lis_len[i] = j + 1;
        if(lis_len[i] > len){
            len = lis_len[i];
            pos = i;
        }
    }
    return len;
}

int main(){
    io_boost;
    cin >> N >> J;
    for(int i = 0; i < N; i++) cin >> a[i];

    for(int i = 0; i < N; i++)
        if((i + 1) * J >= a[i]) s.push_back((i + 1) * J - a[i]);
    cout << N - LIS() << endl;
    return 0;
}

Compilation message

triusis.cpp: In function 'int LIS()':
triusis.cpp:22:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if(j == l.size()) l.push_back(s[i]);
      |            ~~^~~~~~~~~~~
triusis.cpp:19:24: warning: variable 'pos' set but not used [-Wunused-but-set-variable]
   19 |     int lis_len[MAXN], pos;
      |                        ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -