結果
| 問題 | No.266 最終進化を目指せ |
| コンテスト | |
| ユーザー |
y_mazun
|
| 提出日時 | 2015-08-07 23:02:20 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 701 bytes |
| 記録 | |
| コンパイル時間 | 298 ms |
| コンパイル使用メモリ | 64,512 KB |
| 実行使用メモリ | 70,784 KB |
| 最終ジャッジ日時 | 2026-04-01 21:11:00 |
| 合計ジャッジ時間 | 1,160 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#include <queue>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }
#include <set>
using namespace std;
int dp[16][16];
int main(){
const int n = getInt();
vector<int> 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;
}
y_mazun