# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
654261 | bane | Rabbit Carrot (LMIO19_triusis) | C++17 | 37 ms | 7580 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>
#pragma GCC optimize("O2")
using namespace std;
using ll = long long;
using vi = vector<int>;
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
#define ite( x, n) for (int i = x; i<n; i++)
#define jte( x, n) for (int j = x; j<n; j++)
using pii = pair<int,int>;
using pll = pair<ll,ll>;
#define fr first
#define sc second
#define mp make_pair
void setIO(string name = "") {
cin.tie(0)->sync_with_stdio(0); // see /general/fast-io
if (sz(name)) {
freopen((name + ".in").c_str(), "r", stdin); // see /general/input-output
freopen((name + ".out").c_str(), "w", stdout);
}
}
ll inf = 100000000;
int MOD = 1e9 + 7;
int main() {
setIO();
int n,m;
cin >> n >> m;
vector<ll>a(n);
vector<ll>b(n);
ite(0,n){
cin >> a[i];
b[i] = m*(i + 1) - a[i];
}
vector<ll>dp;
for (auto e : b){
if (e < 0)continue;
auto it = upper_bound(dp.begin(), dp.end(), e);
if (it == dp.end()){
dp.pb(e);
}else *it = e;
}
cout<<n - dp.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... |