#include #include #include #include using namespace std;int solve(int n, const vector& a) { int dp[16][n + 1]; memset(dp, -1, sizeof(dp)); // 初始化 dp 数组,初始值为 -1 dp[15][0] = 0; for (int i = 0; i for (int j = 0; j if (dp[j][i] continue; } for (int k = 0; k if ((j & (1 continue; } int ni = i + k + 1; int nj = j ^ (1 if (ni > n) { continue; } if (nj == 0) { nj = 15; } dp[nj][ni] = max(dp[nj][ni], dp[j][i] + a[ni]); } } } int res = -1; for (int i = 1; i res = max(res, dp[i][n]); } return res;}int main() { int n; cin >> n; vector a(n + 1); for (int i = 1; i cin >> a[i]; } cout return 0;}