Submission #700219

# Submission time Handle Problem Language Result Execution time Memory
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);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -