結果
| 問題 |
No.54 Happy Hallowe'en
|
| ユーザー |
a5ua
|
| 提出日時 | 2014-11-05 00:08:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 560 bytes |
| コンパイル時間 | 957 ms |
| コンパイル使用メモリ | 68,040 KB |
| 実行使用メモリ | 15,488 KB |
| 最終ジャッジ日時 | 2024-12-30 17:36:58 |
| 合計ジャッジ時間 | 3,115 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 1 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int N;
cin >> N;
vector<bool> dp(10000 * 10000 + 1, false);
vector<pair<int, int>> v(N);
for (int n = 0; n < N; ++n) {
cin >> v[n].first >> v[n].second;
}
sort(v.begin(), v.end());
dp[0] = true;
int ans = 0;
for (int n = 0; n < N; ++n) {
int V = v[n].first;
int T = v[n].second;
for (int i = T - 1; i >= 0; --i) {
if (dp[i]) {
dp[i + V] = true;
ans = max(ans, i + V);
}
}
}
cout << ans << endl;
}
a5ua