# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
893858 | agawron | Rabbit Carrot (LMIO19_triusis) | C++14 | 22 ms | 4760 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 pb push_back
constexpr int MAX_N = 2e5 + 5;
constexpr int INF = 1e9;
int n, m;
int a[MAX_N];
int b[MAX_N];
vector <int> seq;
int LIS(){
vector<int> min_endings;
for (int i : seq) {
int pos = std::upper_bound(min_endings.begin(), min_endings.end(), i) -
min_endings.begin();
if (pos == min_endings.size()) {
min_endings.push_back(i);
} else {
min_endings[pos] = i;
}
}
return min_endings.size();
}
int main(){
scanf("%d %d", &n, &m);
for(int i = 1; i <= n; i++){
scanf("%d", &a[i]);
}
int cnt = 0;
for(int i = 1; i <= n; i++){
b[i] = m * i - a[i];
if(b[i] >= 0) seq.pb(b[i]);
}
cnt = n - LIS();
printf("%d\n", cnt);
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... |