Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int dfs(vector<int> l, int i, int a, int b, int c, int A, int B, int C int current){
  int n=l.size();
  int res;
  if(i==n){
    res = current+abs(a-A)+abs(b-B)+abs(c-C);
  }else{
    if(a!=0){
      res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current+10);
    }else{
      res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current);
    }
    if(b!=0){
      res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current+10));
    }else{
      res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current));
    }
    if(c!=0){
      res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current+10));
    }else{
      res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current));
    }
  }
  return res;
}
  
  
int main(){
  
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  vector<int> l(n);
  REP(i,n){
    cin>>l[i];
  }
  
  int ans;
  ans = dfs(l,0,0,0,0,a,b,c,0);
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc:89:72: error: expected ',' or '...' before 'int'
   89 | int dfs(vector<int> l, int i, int a, int b, int c, int A, int B, int C int current){
      |                                                                        ^~~
a.cc: In function 'int dfs(std::vector<int>, int, int, int, int, int, int, int)':
a.cc:93:11: error: 'current' was not declared in this scope
   93 |     res = current+abs(a-A)+abs(b-B)+abs(c-C);
      |           ^~~~~~~
a.cc:96:29: error: expected primary-expression before 'l'
   96 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current+10);
      |                             ^
a.cc:96:32: error: expected primary-expression before 'int'
   96 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current+10);
      |                                ^~~
a.cc:96:41: error: expected primary-expression before 'int'
   96 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current+10);
      |                                         ^~~
a.cc:96:53: error: expected primary-expression before 'int'
   96 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current+10);
      |                                                     ^~~
a.cc:96:60: error: expected primary-expression before 'int'
   96 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current+10);
      |                                                            ^~~
a.cc:96:67: error: expected primary-expression before 'int'
   96 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current+10);
      |                                                                   ^~~
a.cc:96:74: error: expected primary-expression before 'int'
   96 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current+10);
      |                                                                          ^~~
a.cc:96:81: error: expected primary-expression before 'int'
   96 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current+10);
      |                                                                                 ^~~
a.cc:98:29: error: expected primary-expression before 'l'
   98 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current);
      |                             ^
a.cc:98:32: error: expected primary-expression before 'int'
   98 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current);
      |                                ^~~
a.cc:98:41: error: expected primary-expression before 'int'
   98 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current);
      |                                         ^~~
a.cc:98:53: error: expected primary-expression before 'int'
   98 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current);
      |                                                     ^~~
a.cc:98:60: error: expected primary-expression before 'int'
   98 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current);
      |                                                            ^~~
a.cc:98:67: error: expected primary-expression before 'int'
   98 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current);
      |                                                                   ^~~
a.cc:98:74: error: expected primary-expression before 'int'
   98 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current);
      |                                                                          ^~~
a.cc:98:81: error: expected primary-expression before 'int'
   98 |       res = dfs(vector<int> l, int i+1, int a+l[i], int b, int c, int A, int B, int C int current);
      |                                                                                 ^~~
a.cc:101:37: error: expected primary-expression before 'l'
  101 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current+10));
      |                                     ^
a.cc:101:40: error: expected primary-expression before 'int'
  101 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current+10));
      |                                        ^~~
a.cc:101:49: error: expected primary-expression before 'int'
  101 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current+10));
      |                                                 ^~~
a.cc:101:56: error: expected primary-expression before 'int'
  101 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current+10));
      |                                                        ^~~
a.cc:101:68: error: expected primary-expression before 'int'
  101 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current+10));
      |                                                                    ^~~
a.cc:101:75: error: expected primary-expression before 'int'
  101 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current+10));
      |                                                                           ^~~
a.cc:101:82: error: expected primary-expression before 'int'
  101 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current+10));
      |                                                                                  ^~~
a.cc:101:89: error: expected primary-expression before 'int'
  101 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current+10));
      |                                                                                         ^~~
a.cc:103:37: error: expected primary-expression before 'l'
  103 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current));
      |                                     ^
a.cc:103:40: error: expected primary-expression before 'int'
  103 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current));
      |                                        ^~~
a.cc:103:49: error: expected primary-expression before 'int'
  103 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current));
      |                                                 ^~~
a.cc:103:56: error: expected primary-expression before 'int'
  103 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current));
      |                                                        ^~~
a.cc:103:68: error: expected primary-expression before 'int'
  103 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current));
      |                                                                    ^~~
a.cc:103:75: error: expected primary-expression before 'int'
  103 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current));
      |                                                                           ^~~
a.cc:103:82: error: expected primary-expression before 'int'
  103 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current));
      |                                                                                  ^~~
a.cc:103:89: error: expected primary-expression before 'int'
  103 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b+l[i], int c, int A, int B, int C int current));
      |                                                                                         ^~~
a.cc:106:37: error: expected primary-expression before 'l'
  106 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current+10));
      |                                     ^
a.cc:106:40: error: expected primary-expression before 'int'
  106 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current+10));
      |                                        ^~~
a.cc:106:49: error: expected primary-expression before 'int'
  106 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current+10));
      |                                                 ^~~
a.cc:106:56: error: expected primary-expression before 'int'
  106 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current+10));
      |                                                        ^~~
a.cc:106:63: error: expected primary-expression before 'int'
  106 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current+10));
      |                                                               ^~~
a.cc:106:75: error: expected primary-expression before 'int'
  106 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current+10));
      |                                                                           ^~~
a.cc:106:82: error: expected primary-expression before 'int'
  106 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current+10));
      |                                                                                  ^~~
a.cc:106:89: error: expected primary-expression before 'int'
  106 |       res = min(res,dfs(vector<int> l, int i+1, int a, int b, int c+l[i], int A, int B, int C int current+10));
      |