# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
827557 | Anthony_Liu | Rabbit Carrot (LMIO19_triusis) | C++11 | 25 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;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
//#pragma GCC optimization ("unroll-loops")
#define f first
#define s second
#define ll long long
#define pb push_back
#define pi pair <int,int>
#define vi vector <int>
#define size(x) (int)(x).size()
#define all(x) x.begin(), x.end()
void setIO(string name = "") {
cin.tie(0)->sync_with_stdio(0);
if (size(name)) {
freopen((name + ".in").c_str(), "r", stdin);
freopen((name + ".out").c_str(), "w", stdout);
}
}
int lis(vi &a) {
vi dp;
for (auto u : a) {
int p = upper_bound(all(dp), u) - dp.begin();
if (p == size(dp)) dp.pb(u);
else dp[p] = u;
}
return size(dp);
}
int N, M;
int main()
{
setIO();
cin >> N >> M;
vi poles(N);
for (int i = 0; i < N; i++) cin >> poles[i];
vi pos;
for (int i = 1; i <= N; i++) {
if (i * M >= poles[i - 1]) {
pos.pb(i * M - poles[i - 1]);
}
}
cout << N - lis(pos) << endl;
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... |