Language: C++

#include <iostream>
#include <climits>
#include <algorithm>
using namespace std;

const int INF = 1<<29;

//dpテーブル
int dp[1000][2020];

int calc_mp(int x,int N,int Len[8]){
  //dpテーブルの初期化
  for (int i = 0; i < 1000; i++) for (int j = 0; j < 2020; j++) dp[i][j] = INF;
  for (int i = 0; i < 1000; i++) for (int k = 0; k < N; k++) dp[i][1000 + Len.at(k)] = 0;

  for (int i = 0; i < 1000; i++){
    for (int l = 0; l < 2020; l++){
      if (l != x){
        if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
        else if (l >= Len.at(6) && l < Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
        else if (l >= Len.at(5) && l < Len.at(6)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
        else if (l >= Len.at(4) && l < Len.at(5)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
        else if (l >= Len.at(3) && l < Len.at(4)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
        else if (l >= Len.at(2) && l < Len.at(3)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
        else if (l >= Len.at(1) && l < Len.at(2)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
        else if (l >= Len.at(0) && l < Len.at(1)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(0)+10);
        else dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1);
      }
      else dp[i+1][l] = dp[i][l];
    }
  }
  return dp[999][x];
}

int main(){
  //入力
  int N;
  cin >> N;
  vector<int> ABC;
  for (int i = 0; i < 3; i++) cin >> ABC.at(i);
  vector<int> Len(8);
  for (int j = 0; j < N; j++) cin >> Len.at(j);

  sort(Len.begin(),Len.end());

  cout >> calc_mp(ABC.at(0),N) + calc_mp(ABC.at(1),N) + calc_mp(ABC.at(2),N) >> endl;
}

Compiler output:
a.cc: In function 'int calc_mp(int, int, int*)':
a.cc:14:79: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   14 |   for (int i = 0; i < 1000; i++) for (int k = 0; k < N; k++) dp[i][1000 + Len.at(k)] = 0;
      |                                                                               ^~
a.cc:19:22: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                      ^~
a.cc:19:86: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                      ^~
a.cc:19:108: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                            ^~
a.cc:19:131: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                   ^~
a.cc:19:153: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                         ^~
a.cc:19:175: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                               ^~
a.cc:19:197: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                                                     ^~
a.cc:19:219: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                                                                           ^~
a.cc:19:241: error: request for member 'at' in 'Len', which is of non-class type 'int*'
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                                                                                                 ^~
a.cc:19:249: error: expected ']' before ')' token
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                                                                                                         ^
      |                                                                                                                                                                                                                                                         ]
a.cc:19:249: error: expected ']' before ')' token
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                                                                                                         ^
      |                                                                                                                                                                                                                                                         ]
a.cc:19:249: error: expected ']' before ')' token
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                                                                                                         ^
      |                                                                                                                                                                                                                                                         ]
a.cc:19:249: error: expected ']' before ')' token
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                                                                                                         ^
      |                                                                                                                                                                                                                                                         ]
a.cc:19:249: error: expected ']' before ')' token
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                                                                                                         ^
      |                                                                                                                                                                                                                                                         ]
a.cc:19:249: error: expected ']' before ')' token
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |                                                                                                                                                                                                                                                         ^
      |                                                                                                                                                                                                                                                         ]
a.cc:19:249: error: expected ']' before ')' token
   19 |         if (l >= Len.at(7)) dp[i+1][l] = min(dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len.at(7)+10, dp[i][l-Len.at(6)+10], dp[i][l-Len.at(5)+10, dp[i][l-Len.at(4)+10, dp[i][l-Len.at(3)+10, dp[i][l-Len.at(2)+10, dp[i][l-Len.at(1)+10, dp[i][l-Len.at(0)+10);
      |