# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
708695 | Green55 | Mountains (IOI17_mountains) | C++17 | 59 ms | 32076 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 "mountains.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define xx first
#define yy second
#define all(v) (v).begin(), (v).end()
// * dp[l][r] : r을 반드시 포함하여 l~r에서 지을 수 있는 최대 개수
// k[] = r에서 보이는 점들의 인덱스들을 순서대로 쓴 배열.
// -> dp[l][r]은 k를 기준으로 partition을 나눠서, 각 최적을 합한 것과 같다.
// k[i] = k[]에서 l의 lower bound.
// opt(l ~ r) = 구간 [l~r]에서 최적 = max{l <= i <= r}(dp[l][i])
// dp[l][r] = opt(l ~ k[i]-1) + opt(k[i]+1, k[i+1]-1) + ...+ opt(k[-2]+1, k[-1]-1) + 1
int n, dp[2020][2020], opt[2020][2020];
ll h[2020];
int get_opt(int l, int r) {
auto &ret = opt[l][r];
if(ret != -1) return ret;
assert(dp[l][r] != -1); assert(dp[l][r] <= r-l+1);
ret = dp[l][r];
if(l <= r-1) ret = max(ret, get_opt(l, r-1));
return ret;
}
bool canSee(int l, int mid, int r) {
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... |