# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
852854 | anha3k25cvp | Mountains (IOI17_mountains) | C++14 | 1 ms | 604 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>
#define ll long long
#define ull unsigned long long
#define dl double
#define st first
#define nd second
#define II pair <int, int>
#include "mountains.h"
using namespace std;
struct Node {
ll x, y;
bool operator <(const Node &O) const {
return x * O.y - y * O.x > 0;
}
};
int maximum_deevs(vector<int> y) {
int n = y.size();
vector <int> f(n, 1);
int ans = 0;
for (int i = 0; i < n; i ++) {
ans = max(ans, f[i]);
Node ma;
for (int j = i + 2; j < n; j ++) {
Node u = {j - 1 - i, y[j - 1] - y[i]}, v = {j - i, y[j] - y[i]};
if (j == i + 2)
ma = u;
else if (ma < u)
ma = u;
if (v < ma)
f[j] = max(f[j], f[i] + 1);
}
}
return ans;
}
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... |