답안 #385530

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
385530 2021-04-04T14:30:41 Z The_Bitch Jelly Flavours (IOI20_jelly) C++14
컴파일 오류
0 ms 0 KB
//#define int long long
#define pb push_back
#define F first
#define S second
using namespace std;
const int N=1e6,M=1e4;
int mem[203][600][600];
long long minn=1e18,mux=-1e18;
int n,x,y;
int a[N],b[N];

int dp(int i,int x,int y){
    if(i==n)return 0;
    if(mem[i][x][y]!=-1)return mem[i][x][y];
    if(x>=a[i]&&y>=b[i])return mem[i][x][y]=max({dp(i+1,x-a[i],y)+1,dp(i+1,x,y-b[i])+1,dp(i+1,x,y)});
    else if(x>=a[i]&&y<b[i])return mem[i][x][y]=max(dp(i+1,x-a[i],y)+1,dp(i+1,x,y));
    else if(x<a[i]&&y>=b[i])return mem[i][x][y]=max(dp(i+1,x,y-b[i])+1,dp(i+1,x,y));
    else return mem[i][x][y]=dp(i+1,x,y);
}

int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {

	n = a.size();

    for(int i=0;i<n+2;i++)
        for(int j=0;j<x+2;j++)
            for(int k=0;k<y+2;k++)
                mem[i][j][k]=-1;

    return dp(0,x,y);
}



Compilation message

jelly.cpp: In function 'int dp(int, int, int)':
jelly.cpp:15:45: error: 'max' was not declared in this scope; did you mean 'mux'?
   15 |     if(x>=a[i]&&y>=b[i])return mem[i][x][y]=max({dp(i+1,x-a[i],y)+1,dp(i+1,x,y-b[i])+1,dp(i+1,x,y)});
      |                                             ^~~
      |                                             mux
jelly.cpp:16:49: error: 'max' was not declared in this scope; did you mean 'mux'?
   16 |     else if(x>=a[i]&&y<b[i])return mem[i][x][y]=max(dp(i+1,x-a[i],y)+1,dp(i+1,x,y));
      |                                                 ^~~
      |                                                 mux
jelly.cpp:17:49: error: 'max' was not declared in this scope; did you mean 'mux'?
   17 |     else if(x<a[i]&&y>=b[i])return mem[i][x][y]=max(dp(i+1,x,y-b[i])+1,dp(i+1,x,y));
      |                                                 ^~~
      |                                                 mux
jelly.cpp: At global scope:
jelly.cpp:21:44: error: 'std::vector' has not been declared
   21 | int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
      |                                            ^~~~~~
jelly.cpp:21:50: error: expected ',' or '...' before '<' token
   21 | int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
      |                                                  ^
jelly.cpp: In function 'int find_maximum_unique(int, int, int)':
jelly.cpp:23:8: error: request for member 'size' in 'a', which is of non-class type 'int [1000000]'
   23 |  n = a.size();
      |        ^~~~