Submission #446753

#TimeUsernameProblemLanguageResultExecution timeMemory
446753zxcvbnmMountains (IOI17_mountains)C++14
0 / 100
1 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 : (i-j) / (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...