# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
640374 | Nafeeszx | Rabbit Carrot (LMIO19_triusis) | C++14 | 95 ms | 6840 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;
#define trav(a, x) for(auto& a : x)
#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define ROF(i, a, b) for (int i=(a); i>=(signed)(b); i--)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define vi vector<int>
#define vvl vector<vector<ll>>
#define all(v) (v).bebbin(), (v).end()
typedef long long ll;
void setIO(string name = "") {
ios_base::sync_with_stdio(0); cin.tie(0);
if(name.size()){
freopen((name+".in").c_str(), "r", stdin);
freopen((name+".out").c_str(), "w", stdout);
}
}
const int MAXN = 2e5;
const ll mod = 1e9 + 7, MOD = 998244353;
int lnds(vector<ll> &a) {
vector<ll> dp;
trav(u, a) {
int j = upper_bound(dp.begin(), dp.end(), u) - dp.begin();
if(j == dp.size()) {
dp.push_back(u);
} else {
dp[j] = u;
}
}
return dp.size();
}
int main()
{
//setIO("cowjog");
int n; ll m; cin >> n >> m;
vector<ll> v;
F0R(i, n) {
ll a; cin >> a;
if(m * (i+1) - a >= 0) v.push_back(m * (i + 1) - a);
}
cout << n - lnds(v);
return 0;
}
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... |