제출 #299828

#제출 시각아이디문제언어결과실행 시간메모리
299828MarcoMeijerMountains (IOI17_mountains)C++14
20 / 100
1 ms384 KiB
#include "mountains.h"
#include <bits/stdc++.h>

using namespace std;

#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define RE(a,b) REP(a,0,b)
#define FOR(a,b) for(auto& a:b)
#define pb push_back
#define fi first
#define se second
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int INF=1e9;
const int MX=1e5;
const ld EPS=1e-17;

int maximum_deevs(vi y) {
    int n = y.size();
    vi dp; dp.resize(n);
    RE(i,n) {
        dp[i] = 1;
        ld mx = -1e18;
        REV(j,0,i) {
            ld cur = ld(y[j]-y[i])/ld(i-j);
            if(cur+EPS <= mx)
                dp[i] = max(dp[i], dp[j]+1);
            mx = max(mx, cur);
        }
    }
    int ans = 0;
    RE(i,n) ans = max(ans, dp[i]);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...