# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
917150 | sano | Rabbit Carrot (LMIO19_triusis) | C++17 | 1 ms | 348 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 <iostream>
#include <string>
#include <string.h>
#include <fstream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include<map>
#include <stack>
#include <unordered_map>
#include <set>
#include <math.h>
#include <cstdlib>
#include <time.h>
#define ll long long
#define For(i, n) for(int i = 0; i < n; ++i)
#define ffor(i, a, n) for(int i = a; i < n; ++i)
#define pb push_back
#define vec vector
#define ff first
#define ss second
#define pairs pair<sui, sui>
#define NEK 1000000000
#define mod 1000000007
#define vel 1000
using namespace std;
typedef unsigned short int sui;
int lis(vec<int> a) {
vec<int> dp;
For(i, a.size()) {
auto x = upper_bound(dp.begin(), dp.end(), a[i]*(-1));
if (x == dp.end()) {
dp.push_back(a[i] * (-1));
}
else {
*x = a[i]*(-1);
}
}
return dp.size();
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ifstream cin("cowjog.in");
//ofstream cout("cowjog.out");
int n, m;
cin >> n >> m;
vec<int> a;
For(i, n) {
int x;
cin >> x;
if(x - m*i <= 0) {
a.push_back(x - m * i);
}
}
cout << n - lis(a) << '\n';
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... |