이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define long long long int
#define DEBUG
using namespace std;
// @author: pashka
int main() {
ios::sync_with_stdio(false);
int n;
long m;
cin >> n >> m;
vector<long> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) {
a[i] = i * m - a[i];
}
vector<long> d(n + 1, LLONG_MAX);
d[0] = 0;
int res = 0;
for (int i = 0; i < n; i++) {
int j = lower_bound(d.begin(), d.end(), a[i] + 1) - d.begin();
if (j > 0) {
d[j] = a[i];
res = max(res, j);
}
}
cout << n - res << "\n";
return 0;
}
# | 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... |