답안 #394951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
394951 2021-04-27T14:21:42 Z Qw3rTy Rabbit Carrot (LMIO19_triusis) C++11
0 / 100
1 ms 332 KB
#include <bits/stdc++.h>
using namespace std;

const int maxN = 2e5+5;

int f[maxN];
int a[maxN];
int b[maxN];
int N,M;

void testIO(){
    freopen("../test.in","r",stdin);
    return;
}

int LIS(){
    deque<int> dp;
    for(int i = 1; i <= N; ++i){
        if(b[i] > 0)continue;
        int pos = lower_bound(dp.begin(),dp.end(),a[i]) - dp.begin();
        if(pos == 0)dp.push_front(a[i]);
        else dp[pos] = a[i];
    }
    return dp.size();
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //testIO();
    cin >> N >> M;
    for(int i = 1; i <= N; ++i)cin >> a[i];
    a[0] = 0;
    f[0] = 0;
    //O(NlogN)
    //find LIS on b[i], where b[i] = a[i] - M*i
    for(int i = 1; i <= N; ++i)b[i] = a[i] - M*i;
    int res = LIS();
    cout << N - res << '\n';
    return 0;
}

Compilation message

triusis.cpp: In function 'void testIO()':
triusis.cpp:12:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     freopen("../test.in","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 224 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 224 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 224 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 224 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Halted 0 ms 0 KB -