結果
問題 | No.54 Happy Hallowe'en |
ユーザー | ciel |
提出日時 | 2014-11-17 01:41:49 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 555 bytes |
コンパイル時間 | 406 ms |
コンパイル使用メモリ | 50,048 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-30 08:51:10 |
合計ジャッジ時間 | 1,632 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 7 ms
4,376 KB |
testcase_05 | AC | 12 ms
4,380 KB |
testcase_06 | AC | 17 ms
4,376 KB |
testcase_07 | AC | 25 ms
4,376 KB |
testcase_08 | AC | 33 ms
4,380 KB |
testcase_09 | AC | 42 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,376 KB |
testcase_12 | AC | 41 ms
4,376 KB |
testcase_13 | AC | 42 ms
4,380 KB |
testcase_14 | AC | 2 ms
4,376 KB |
testcase_15 | AC | 2 ms
4,376 KB |
testcase_16 | WA | - |
testcase_17 | AC | 2 ms
4,380 KB |
testcase_18 | AC | 1 ms
4,376 KB |
ソースコード
#include <vector> #include <algorithm> #include <cstdio> int main(){ int n,vmax=0,tmax=0; scanf("%d",&n); std::vector<std::pair<int,int> >v(n); for(int i=0;i<n;i++){ scanf("%d%d",&v[i].first,&v[i].second); if(vmax<v[i].first)vmax=v[i].first; if(tmax<v[i].second)tmax=v[i].second; } std::sort(v.begin(),v.end()); std::vector<int>bag(tmax+vmax+1); bag[0]=1; for(int i=0;i<n;i++){ for(int j=v[i].second-1;j>=0;j--)bag[j+v[i].first]|=bag[j]; } for(int i=tmax+vmax;i>=0;i--)if(bag[i]){ printf("%d\n",i); break; } }