제출 #1336049

#제출 시각아이디문제언어결과실행 시간메모리
1336049yc11Bikeparking (EGOI24_bikeparking)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
int n;
vector<int> n1;
vector<int> n2;
int n3[100][100][100];
int hi(int id,int f,int s){
    if (n3[id][f][s]!=-1e8) return n3[id][f][s];
    if ((id==0 and f>0) or f<0 or s<0 ) return -1e8;
    if (id==0){
        return f-(n2[0]-f-s);
    }


    int ans = -1e9;
    int x = f-n2[id]+f+s;
    for (int i = 0;i<=min(min(n2[id-1],n1[id-1]),n1[id-1]-f);i++){

        for (int j = 0;j<=n2[id-1]-i;j++){
          
            ans = max(ans,hi(id-1,j,i)+x;

        }
    }
    n3[id][f][s] = ans;

    return  ans;

    }
signed main(){
    cin>>n;
    n1.resize(n);
    n2.resize(n);
    for (int i = 0;i<100;i++){
        for (int j = 0;j<100;j++){
            for (int k = 0;k<100;k++) n3[i][j][k] = -1e8;
        }
    }
    for (int i = 0;i<n;i++) cin>>n1[i];
    for (int i = 0;i<n;i++) cin>>n2[i];


    int ans = -1e8;
    for (int i = 0;i<=min(n2[n-1],n1[n-1]);i++){
      int x = n2[n-1]-j-i;
        for (int j = 0;j<=n2[n-1]-i;j++){
            ans = max(ans,hi(n-1,j,i)-x;
        }
    }
    cout<<ans<<"\n";;


    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int hi(int, int, int)':
Main.cpp:21:41: error: expected ')' before ';' token
   21 |             ans = max(ans,hi(id-1,j,i)+x;
      |                      ~                  ^
      |                                         )
Main.cpp: In function 'int main()':
Main.cpp:45:23: error: 'j' was not declared in this scope
   45 |       int x = n2[n-1]-j-i;
      |                       ^
Main.cpp:47:40: error: expected ')' before ';' token
   47 |             ans = max(ans,hi(n-1,j,i)-x;
      |                      ~                 ^
      |                                        )