Submission #890167

# Submission time Handle Problem Language Result Execution time Memory
890167 2023-12-20T16:12:19 Z Azzmi Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n, m;
int a[200'001];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        a[i] -= i * m;
    }
    vector<int> dp;
    for (int i = 0; i < n+1; ++i) {
        auto pos = upper_bound(dp.begin(), dp.end(), a[i]) - dp.begin();
        if (pos == dp.size()) {
            dp.push_back(a[i]);
        } else {
            dp[pos] = a[i];
        }
    }
    cout << (int)dp.size() - 1 << '\n';
}

Compilation message

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