답안 #700219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
700219 2023-02-19T01:28:30 Z LucasLe Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>
using namespace std;

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("cowjog.out", "w", stdout);
#endif

    int N, M; cin >> N >> M;
    vector<int> b;
    for (int i = 1; i <= N; ++i) {
        int x; cin >> x;
        if (x <= M * i) {
            b.push_back(M * i - x);
        }
    }

    vector<int> lis;
    for (int x : b) {
        int pos = upper_bound(lis.begin(), lis.end(), x) - lis.begin();
        if (pos == lis.size()) lis.push_back(x);
        else lis[pos] = x;
    }

    cout << N - lis.size();
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:22:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if (pos == lis.size()) lis.push_back(x);
      |             ~~~~^~~~~~~~~~~~~
triusis.cpp:6:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -