# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
610981 | 2022-07-28T21:53:53 Z | lucas_joel_han | Rabbit Carrot (LMIO19_triusis) | C++14 | 1 ms | 320 KB |
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, M; cin >> N >> M; vector<int> a(N), b; for (int i = 0; i < N; i++) { cin >> a[i]; if (M * i >= a[i]) b.push_back(M * i - a[i]); } vector<int> dp(b.size() + 1, INT_MAX); dp[0] = INT_MIN; for (int i = 0; i < b.size(); i++) { int x = b[i]; int j = upper_bound(dp.begin(), dp.end(), x) - dp.begin(); if (dp[j - 1] <= x && x <= dp[j]) { dp[j] = x; } } int sol = 0; for (int i = 0; i <= b.size(); i++) { if (dp[i] != INT_MAX) { sol = i; } } cout << (N - sol) << '\n'; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |