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 "mountains.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct pt {
ll x, y;
};
int ccw(pt a, pt b, pt c) {
ll t = (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);
return t ? (t > 0 ? 1 : -1) : 0;
}
int dp[2020] = {};
int maximum_deevs(std::vector<int> y) {
int n = y.size();
for (int i = 0; i < n; i++) {
dp[i] = 1;
for (int j = 0; j < i; j++) {
bool flag = false;
for (int k = j + 1; k < i; k++)
if (ccw({ j,y[j] }, { i,y[i] }, { k,y[k] }) > 0) flag = true;
if (flag) dp[i] = max(dp[i], dp[j] + 1);
}
}
int ans = 0;
for (int i = 0; i < n; i++) ans = max(ans, dp[i]);
return ans;
}
# | 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... |