# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580447 | kalash04 | Rabbit Carrot (LMIO19_triusis) | C++17 | 36 ms | 5320 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll MOD = 1e9 + 7;
void solve() {
int n, m;
cin >> n >> m;
vector<int> poles(n);
for(int &pole : poles) cin >> pole;
vector<int> unchange;
for(int i = 1; i <= n; i++) {
int val = i * m - poles[i - 1];
if(val >= 0) unchange.push_back(val);
}
vector<int> dp;
for(int item : unchange) {
int idx = upper_bound(dp.begin(), dp.end(), item) - dp.begin();
if(idx == dp.size())
dp.push_back(item);
else
dp[idx] = item;
}
cout << n - dp.size() << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
}
Compilation message (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... |