Submission #972940

# Submission time Handle Problem Language Result Execution time Memory
972940 2024-05-01T10:34:53 Z njoop Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

int n, m, in, idx;
vector<int> dp;

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> n >> m;
    for(int i=1; i<=n; i++) {
        cin >> in;
        in = i*m - in;
        if(in < 0) continue;
        idx = upper_bound(dp.begin(), dp.end(), idx) - dp.begin();
        if(idx == dp.size()) dp.push_back(in);
        else dp[idx] = in;
    }
    cout << n - dp.size();
    return 0;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:16:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         if(idx == dp.size()) dp.push_back(in);
      |            ~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -