이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "mountains.h"
#include <bits/stdc++.h>
using namespace std ;
int maximum_deevs(std::vector<int> y) {
int ret = 0 ;
int n = y.size() ;
bool gd[n+1][n+1] ;
memset(gd , 0 , sizeof gd) ;
for(int i = 0 ; i < n ;i++){
for(int j = i+1 ; j< n;j++){
for(int k = i+1 ; k < j ;k++){
double slp = 1.0 * (y[i] - y[j]) /( i - j) ;
double o = -1 ;
double c = y[i] - slp * i ;
if(k * slp + y[k] * o + c < 0){
gd[i][j] = gd[j][i] = 1;
}
else gd[i][j] = gd[j][i] = 0 ;
}
}
}
vector<int> dp(n+1 , 0) ;
for(int i =0 ; i < n;i++){
dp[i] =1 ;
for(int j = 0 ; j < i ;j++){
if(gd[i][j]){
dp[i] = max(dp[i] , dp[j] +1) ;
}
}
ret = max(ret , dp[i]) ;
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |