func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 5010;   const int INF = 1e5;   static int N, val[MAXN], dp[MAXN][MAXN][2];   int main() {     scanf( %d , &N);     for (int i = 1; i <= N; i++) scanf( %d , &val[i]);     val[0] = -INF;     memset(dp, 0x3f, sizeof dp);     dp[0][0][0] = dp[1][0][0] = dp[1][1][1] = 0;     for (int i = 2; i <= N; i++) {       dp[i][0][0] = 0;       for (int j = 1; j <= i; j++) {         int sub0 = max(0, val[i] - val[i - 1] + 1);         int sub1 = max(0, val[i - 1] - val[i] + 1);         int sub2 = max(0, max(val[i - 1] - val[i], val[i - 1] - val[i - 2]) + 1);         dp[i][j][0] = min(dp[i - 1][j][0], dp[i - 1][j][1] + sub0);         dp[i][j][1] = min(dp[i - 2][j - 1][0] + sub1, dp[i - 2][j - 1][1] + sub2);       }     }     for (int i = 1; i <= (N + 1) / 2; i++)       printf( %d  , min(dp[N][i][0], dp[N][i][1]));     puts(  );     return 0;   }   