func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, a, b, h[20], f[20][20][20][20], g[20][20][20][20][5];   void update(int &f1, int f2, int p[5], int i, int j, int k, int l, int w) {     if (f2 < f1) {       f1 = f2;       p[0] = w;       p[1] = i;       p[2] = j;       p[3] = k;       p[4] = l;     }   }   int main() {     cin >> n >> a >> b;     memset(h, 0, sizeof h);     for (int i = 0; i < n; i++) {       scanf( %d , h + i);       h[i]++;     }     memset(f, 0x3f, sizeof f);     f[1][h[0]][h[1]][h[2]] = 0;     memset(g, 0xff, sizeof g);     for (int i = 1; i < n; i++) {       for (int j = 16; j >= 0; j--) {         for (int k = 16; k >= 0; k--)           for (int l = 16; l >= 0; l--) {             if (j == 0)               update(f[i + 1][k][l][h[i + 2]], f[i][j][k][l],                      g[i + 1][k][l][h[i + 2]], g[i][j][k][l][1], g[i][j][k][l][2],                      g[i][j][k][l][3], g[i][j][k][l][4], g[i][j][k][l][0]);             if (i != n - 1) {               int j1 = j - b > 0 ? j - b : 0, k1 = k - a > 0 ? k - a : 0,                   l1 = l - b > 0 ? l - b : 0;               if (j <= b)                 update(f[i + 1][k1][l1][h[i + 2]], f[i][j][k][l] + 1,                        g[i + 1][k1][l1][h[i + 2]], i, j, k, l, i);               update(f[i][j1][k1][l1], f[i][j][k][l] + 1, g[i][j1][k1][l1], i, j,                      k, l, i);             }             if (i != 1) {               int j1 = j - a > 0 ? j - a : 0, k1 = k - b > 0 ? k - b : 0;               if (j <= a)                 update(f[i + 1][k1][l][h[i + 2]], f[i][j][k][l] + 1,                        g[i + 1][k1][l][h[i + 2]], i, j, k, l, i - 1);               update(f[i][j1][k1][l], f[i][j][k][l] + 1, g[i][j1][k1][l], i, j, k,                      l, i - 1);             }           }       }     }     cout << f[n - 1][0][0][0] << endl;     int i = n - 1, j = 0, k = 0, l = 0;     while (i != -1) {       if (g[i][j][k][l][0] == -1) break;       printf( %d  , g[i][j][k][l][0] + 1);       int i1 = g[i][j][k][l][1], j1 = g[i][j][k][l][2], k1 = g[i][j][k][l][3],           l1 = g[i][j][k][l][4];       i = i1, j = j1, k = k1, l = l1;     }     return 0;   }   