Submission #821691

# Submission time Handle Problem Language Result Execution time Memory
821691 2023-08-11T13:15:28 Z Youssif_Elkadi Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 256 KB
#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5, M = 11, inf = 1e9 + 5, mod = 1e9 + 7;
long long dp[N];
long long n, m;
long long arr[N];
int main()
{
    cin >> n >> m;
    dp[0] = 0;
    long long mx = 0;
    for (long long i = 1; i <= n; i++)
        dp[i] = inf;
    arr[0] = 0;
    bool flag = 0;
    for (long long i = 1; i <= n; i++)
    {
        cin >> arr[i];
        if (i == 1)
        {
            if (arr[i] > m)
            {
                flag = 1;
                continue;
            }
        }
        arr[i] = -(arr[i] - i * m);
        long long it = upper_bound(dp, dp + n + 1, arr[i]) - dp;
        mx = max(mx, it);
        dp[it] = arr[i];
    }
    cout << n - mx + flag;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -