Submission #308301

#TimeUsernameProblemLanguageResultExecution timeMemory
308301kimjg1119Mountains (IOI17_mountains)C++17
20 / 100
1 ms384 KiB
#include "mountains.h" #include <vector> #include <bits/stdc++.h> using namespace std; typedef long long ll; struct pt { ll x, y; }; int ccw(pt a, pt b, pt c) { ll t = (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y); return t ? (t > 0 ? 1 : -1) : 0; } int dp[2020] = {}; int maximum_deevs(std::vector<int> y) { int n = y.size(); for (int i = 0; i < n; i++) { dp[i] = 1; for (int j = 0; j < i; j++) { bool flag = false; for (int k = j + 1; k < i; k++) if (ccw({ j,y[j] }, { i,y[i] }, { k,y[k] }) > 0) flag = true; if (flag) dp[i] = max(dp[i], dp[j] + 1); } } int ans = 0; for (int i = 0; i < n; i++) 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...