제출 #1304653

#제출 시각아이디문제언어결과실행 시간메모리
1304653joeyao67Rabbit Carrot (LMIO19_triusis)C++20
0 / 100
1 ms572 KiB
#include <bits/stdc++.h>
using namespace std;

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

    int N;
    long long M;
    cin >> N >> M;

    vector<long long> dp;
    dp.reserve(N);

    for (int i = 1; i <= N; i++) {
        long long a;
        cin >> a;

        long long b = a - i * M;
        long long c = -b;

        auto it = upper_bound(dp.begin(), dp.end(), c);
        if (it == dp.end())
            dp.push_back(c);
        else
            *it = c;
    }

    cout << N - (int)dp.size() << "\n";
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...