# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
240169 | lyc | Mountains (IOI17_mountains) | C++14 | 44 ms | 16384 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;
#define TRACE(x) cout << #x << " :: " << x << endl;
#define _ << " " <<
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
const double EPS = 1e-6;
const int mxN = 2e3+5;
int memo[mxN][mxN];
int solve(int l, int r, vector<int>& y) {
if (l > r) return 0;
if (l == r) return 1;
if (~memo[l][r]) return memo[l][r];
int mx = l;
FOR(i,l+1,r) if (y[i] > y[mx]) mx = i;
memo[l][r] = solve(l,mx-1,y) + solve(mx+1,r,y);
int cur = 1;
if (l < mx-1) {
int j = mx-2;
double mng = (double)(y[mx]-y[mx-1]);
RFOR(i,mx-2,l){
double g = (double)(y[mx]-y[i])/(mx-i);
if (g < mng+EPS) {
mng = g;
# | 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... |