# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
438839 | KhoaHo | Rabbit Carrot (LMIO19_triusis) | C++11 | 3 ms | 332 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.
///KhoaHo///
#include<bits/stdc++.h>
using namespace std;
///define-zone
#define task "test"
#define vec vector
#define priq priority_queue
#define pf push_front
#define pb push_back
#define popb pop_back
#define popf pop_front
#define SZ(a) a.begin(), a.end()
#define SZZ(a, begin, end) a + begin, a + begin + end
#define fi first
#define se second
#define N int(5e5) + 1
///typedef-zone
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldb;
typedef double db;
typedef pair<int, int> ii;
typedef pair<long long, long long> pll;
typedef pair<int, ii> iii;
///code-mau
template<class val> inline val gcd(val a, val b){ return (a ? gcd(b%a, a): b);}
void init()
{
freopen(task".inp","r",stdin);
freopen(task".out","w",stdout);
}
void fastio()
{
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
cout.tie(NULL);
}
int n, m, a[N];
vec<int> dp;
int main()
{
init();
fastio();
cin >> n >> m;
for(int i = 1; i <= n; i++)
{
cin >> a[i];
if(m*i - a[i] >= 0) dp.pb(m*i - a[i]);
}
vec<int> g;
for(int i = 0; i < (int)dp.size(); i++)
{
int k = upper_bound(SZ(g), dp[i]) - g.begin();
if(k == (int)g.size()) g.pb(dp[i]);
else g[k] = dp[i];
}
///for(int i = 0; i < dp.size(); i++) cout << dp[i] << " \n"[i == dp.size() - 1];
cout << n - (int)g.size();
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... |