답안 #540523

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
540523 2022-03-20T16:32:18 Z juankipedia Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 340 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 = lower_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;
      |                        ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -