답안 #755582

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755582 2023-06-10T11:24:33 Z ETheBest3 Mountains (IOI17_mountains) C++17
컴파일 오류
0 ms 0 KB
#include "mountains.h"
#define lli long long
#define endl "\n"
#include <vector>
const lli MAXN=2005;
lli dp[MAXN][MAXN], N, ss, last;
struct points{
    lli x, y;
};
points p[MAXN];
bool ccw(points a, points b, points c){
    return (a.x*b.y+a.y*c.x+b.x*c.y)-(c.x*b.y+c.y*a.x+b.x*a.y)>=0;
}
int maximum_deevs(std::vector<int> y) {
    N=y.size();
    for(lli i=0; i<N; i++){
        p[i]={i, y[i]};
    }
    for(lli i=0; i<N; i++)dp[i][i]=1;
    for(lli r=0; r<N; r++){
        last=r;
        ss=0;
        for(lli l=r-1; l>=0; l--){
            dp[l][r]=dp[l][r-1];
            if(ccw(p[l], p[last], p[r])){
                ss+=dp[l+1][last-1];
                last=l;
            }
            dp[l][r]=max(dp[l][r], 1+ss+dp[l][last-1]);
        }
    }
    return dp[0][N-1];
}

Compilation message

mountains.cpp: In function 'int maximum_deevs(std::vector<int>)':
mountains.cpp:29:22: error: 'max' was not declared in this scope; did you mean 'std::max'?
   29 |             dp[l][r]=max(dp[l][r], 1+ss+dp[l][last-1]);
      |                      ^~~
      |                      std::max
In file included from /usr/include/c++/10/vector:60,
                 from mountains.h:1,
                 from mountains.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: 'std::max' declared here
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~