結果
問題 |
No.54 Happy Hallowe'en
|
ユーザー |
![]() |
提出日時 | 2015-05-29 21:31:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 469 bytes |
コンパイル時間 | 518 ms |
コンパイル使用メモリ | 60,148 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 11:05:11 |
合計ジャッジ時間 | 1,671 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 1 |
ソースコード
#include<iostream> #include<utility> #include<algorithm> using namespace std; typedef pair<int,int> P; P p[10010]; bool dp[20010] = {true}; int main(){ int n; cin >> n; for (int i = 0; i < n; i++){ cin >> p[i].first >> p[i].second; } sort(p, p + n); for (int i = 0; i < n; i++){ for (int j = p[i].second - 1; j >= 0; j--){ dp[j + p[i].first] |= dp[j]; } } int res = 0; for (int i = 0; i < 20010; i++){ if (dp[i])res = i; } cout << res << endl; }