# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
942500 | mannshah1211 | Rabbit Carrot (LMIO19_triusis) | C++17 | 22 ms | 4624 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.
/**
* author: hashman
* created:
**/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
int lis(const vector<int>& a, int x) {
vector<int> ret;
ret.push_back(x);
for (int i = 0; i < a.size(); i++) {
int it = a[i];
auto pos = lower_bound(ret.begin(), ret.end(), it + 1);
if (pos == ret.end()) {
ret.push_back(it);
} else {
ret[pos - ret.begin()] = it;
}
}
return (int) ret.size();
}
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> foo;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
foo.push_back((i * m) - x);
}
vector<int> bar;
for (auto it : foo) {
if (it >= 0) bar.push_back(it);
}
cout << n + 1 - lis(bar, 0) << '\n';
}
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... |