#define REP(i,n) for(int i=0; i<(int)(n); i++) #include #include inline int getInt(){ int s; scanf("%d", &s); return s; } #include using namespace std; int dp[16][16]; int main(){ const int n = getInt(); vector s(n + 1); REP(i,n+1) s[i] = getInt(); const int inf = 1 << 29; REP(i,n+1) REP(j,s[i]+1) dp[i][j] = inf; dp[0][0] = 1; REP(i,n+1){ if(i != 0){ REP(j,s[i-1]+1) dp[i][j] = dp[i-1][j] + 1; } REP(j,s[i]+1){ REP(k,j) dp[i][j] = min(dp[i][j], dp[i][k] + dp[i][j - k - 1]); // printf("%d %d: %2d\n", i, j, dp[i][j] == inf ? -1 : dp[i][j]); } } REP(i,s[n]+1) printf("%d ", dp[n][i]); puts(""); return 0; }