結果
問題 | No.54 Happy Hallowe'en |
ユーザー | goodbaton |
提出日時 | 2015-07-30 19:30:01 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 56 ms / 5,000 ms |
コード長 | 924 bytes |
コンパイル時間 | 621 ms |
コンパイル使用メモリ | 77,552 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-05 20:07:58 |
合計ジャッジ時間 | 1,582 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 10 ms
4,380 KB |
testcase_05 | AC | 15 ms
4,376 KB |
testcase_06 | AC | 21 ms
4,376 KB |
testcase_07 | AC | 32 ms
4,380 KB |
testcase_08 | AC | 41 ms
4,380 KB |
testcase_09 | AC | 56 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,376 KB |
testcase_12 | AC | 53 ms
4,380 KB |
testcase_13 | AC | 54 ms
4,380 KB |
testcase_14 | AC | 2 ms
4,380 KB |
testcase_15 | AC | 1 ms
4,380 KB |
testcase_16 | AC | 1 ms
4,376 KB |
testcase_17 | AC | 2 ms
4,376 KB |
testcase_18 | AC | 1 ms
4,380 KB |
ソースコード
#include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <cstring> typedef long long ll; using namespace std; #define mod 1000003 #define INF 10000000 #define LLINF 2000000000000000000LL #define SIZE 10000 int n; int v,t; pair<int,pair<int,int> > vt[SIZE]; bool dp[SIZE*2+10]; int main(){ scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d%d",&v,&t); vt[i] = {v+t,{v,t}}; } sort(vt,vt+n); dp[0] = true; for(int i=0;i<n;i++){ for(int j=vt[i].second.second-1;j>=0;j--){ if(dp[j]) dp[j+vt[i].second.first]=true; } } for(int i=SIZE*2+19;i>=0;i--){ if(dp[i]){ printf("%d\n",i); break; } } }