Submission #299829

#TimeUsernameProblemLanguageResultExecution timeMemory
299829MarcoMeijerMountains (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;

struct Fract {
    ll t, b;

    bool operator <(Fract other) {
        return t*other.b < other.t*b;
    }
};

int maximum_deevs(vi y) {
    int n = y.size();
    vi dp; dp.resize(n);
    RE(i,n) {
        dp[i] = 1;
        Fract mx = {(ll)-1e9, 1ll};
        REV(j,0,i) {
            Fract cur = {y[j]-y[i], i-j};
            if(cur < mx)
                dp[i] = max(dp[i], dp[j]+1);
            if(mx < cur) 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...