# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172766 | gs18103 | Mountains (IOI17_mountains) | C++14 | 139 ms | 14024 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>
#define eb emplace_back
#define em emplace
#define fi first
#define se second
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const int MAX = 2020;
const int INF = 1<<30;
const ll LINF = 1LL<<62;
int dp[MAX][MAX];
ll h[MAX];
int f(int s, int e) {
if(s > e) return 0;
if(dp[s][e] != 0) return dp[s][e];
dp[s][e] = 1;
pll high = make_pair(h[s+1] - h[s], 1);
int idx = s + 1;
for(int i = s + 2; i <= e; i++) {
if((h[i] - h[s]) * high.se >= high.fi * (i - s)) {
dp[s][e] += f(idx+1, i-1);
idx = i;
# | 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... |