Submission #61397

#TimeUsernameProblemLanguageResultExecution timeMemory
61397kingpig9Mountains (IOI17_mountains)C++11
0 / 100
4 ms492 KiB
#include <bits/stdc++.h> #include "mountains.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 2018; #define debug(...) fprintf(stderr, __VA_ARGS__) #define fi first #define se second #define all(v) (v).begin(), (v).end() #define fillchar(a, s) memset((a), (s), sizeof(a)) int N; int dp[MAXN][MAXN], A[MAXN]; int maximum_deevs (vector<int> v) { N = v.size(); copy(all(v), A); for (int rt = 0; rt < N; rt++) { dp[rt][rt] = 1; int block = rt; //which one IS BLOCKING others? int notsee = 0; //which one you guarantee not see? for (int lt = rt - 1; lt >= 0; lt--) { dp[lt][rt] = dp[lt][rt - 1]; if (ll(rt - block) * (A[lt] - A[block]) >= ll(lt - block) * (A[rt] - A[block])) { if (lt + 1 <= block - 1) { notsee += dp[lt + 1][block - 1]; } block = lt; } if (lt < block) { dp[lt][rt] = max(dp[lt][rt], notsee + 1 + dp[lt][block - 1]); } } } return dp[0][N - 1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...