# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
120562 | sofhiasouza | Mountains (IOI17_mountains) | C++14 | 38 ms | 14332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//In the name of God
//...
#include <iostream>
#include "mountains.h"
using namespace std;
const int N = 2016;
int n, x[N], y[N], dp[N][N];
long long rot(int a, int b, int c) { return 1ll * (x[b] - x[a]) * (y[c] - y[a]) - 1ll * (y[b] - y[a]) * (x[c] - x[a]); }
int maximum_deevs(vector<int> h) {
int n = h.size();
for (int i = 0; i < n; i++) {
x[i] = i;
y[i] = h[i];
}
for (int e = 1; e <= n; e++) {
dp[e][e] = dp[e - 1][e] = 1;
int ls = e - 1, res = 0;
for (int b = e - 2; b > 0; b--) {
if (rot(b - 1, ls - 1, e - 1) >= 0) { // b is seen
res += dp[b + 1][ls - 1];
ls = b;
}
dp[b][e] = max(dp[b][e - 1], 1 + res + dp[b][ls - 1]);
}
}
return dp[1][n];
}
# | 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... |