# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
610983 | lucas_joel_han | Rabbit Carrot (LMIO19_triusis) | C++14 | 30 ms | 3152 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 + 1) >= a[i])
b.push_back(M * (i + 1) - 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';
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |