# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
880695 | a5a7 | Rabbit Carrot (LMIO19_triusis) | C++14 | 75 ms | 8388 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;
typedef long long ll;
int main(){
ll n, m;
cin >> n >> m;
ll a[n];
for (int i = 0; i < n; i++) cin >> a[i];
vector<ll> b;
for (int i = 0; i < n; i++){
if (m * (i+1) < a[i]) continue;
b.push_back(m*(i+1)-a[i]);
}
vector<ll> dp;
for (ll i : b){
int pos = upper_bound(dp.begin(), dp.end(), i) - dp.begin();
if (pos == dp.size()){
dp.push_back(i);
}else{
dp[pos] = i;
}
}
cout << (n-dp.size()) << endl;
}
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... |