結果
| 問題 |
No.54 Happy Hallowe'en
|
| コンテスト | |
| ユーザー |
ss_koishi
|
| 提出日時 | 2014-11-06 16:18:01 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 568 bytes |
| コンパイル時間 | 560 ms |
| コンパイル使用メモリ | 53,852 KB |
| 実行使用メモリ | 44,160 KB |
| 最終ジャッジ日時 | 2024-12-30 17:54:59 |
| 合計ジャッジ時間 | 33,712 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 1 RE * 9 TLE * 1 |
ソースコード
#include <iostream>
#define INF (2 << 24)
using namespace std;
int n, v[11111], t[11111];
int dp[10001][10001];
int rec(int sum, int home){
if(dp[sum][home]) return dp[sum][home];
int ret = 0;
bool judge = true;
for(int i = 0; i < n; i++){
if(sum < t[i]){
ret = max(ret, rec(sum + v[i], home + 1) + v[i]);
judge = false;
}
}
if(judge) return 0;
return dp[sum][home] = ret;
}
int main(){
cin >> n;
for(int i = 0; i < n; i++){
cin >> v[i] >> t[i];
}
cout << rec(0, 0) << endl;
}
ss_koishi