Submission #446755

#TimeUsernameProblemLanguageResultExecution timeMemory
446755zxcvbnmMountains (IOI17_mountains)C++14
0 / 100
0 ms204 KiB
#include "mountains.h" #include <bits/stdc++.h> using namespace std; vector<int> a; bool can(int i, int j) { double slope = (a[i] == a[j] ? 0.0 : ((double) i-j) / ((double) a[i]-a[j])); double curr = a[i]; for(int k = i+1; k < j; k++) { curr += slope; if ((double) a[k] > curr) { return true; } } return false; } int maximum_deevs(std::vector<int> y) { int n = y.size(); a = y; vector<int> dp(n+1, 1); for(int i = 0; i < n; i++) { for(int j = i+1; j < n; j++) { if (can(i, j)) { dp[j] = max(dp[j], dp[i]+1); } } } // for(int i : dp) { // cout << i << " "; // } return *max_element(dp.begin(), dp.end()); } //int main() { // //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...