結果
問題 | No.54 Happy Hallowe'en |
ユーザー | kotatsugame |
提出日時 | 2021-01-10 06:39:44 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 17 ms / 5,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 698 ms |
コンパイル使用メモリ | 80,712 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-04-30 13:10:10 |
合計ジャッジ時間 | 1,617 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 6 ms
6,940 KB |
testcase_05 | AC | 7 ms
6,940 KB |
testcase_06 | AC | 10 ms
6,940 KB |
testcase_07 | AC | 12 ms
6,944 KB |
testcase_08 | AC | 14 ms
6,940 KB |
testcase_09 | AC | 17 ms
6,940 KB |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | AC | 1 ms
6,944 KB |
testcase_12 | AC | 15 ms
6,944 KB |
testcase_13 | AC | 15 ms
6,940 KB |
testcase_14 | AC | 2 ms
6,940 KB |
testcase_15 | AC | 2 ms
6,940 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | AC | 2 ms
6,940 KB |
testcase_18 | AC | 2 ms
6,944 KB |
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 9 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> #include<vector> #include<bitset> using namespace std; int N; using bit=bitset<20202>; bit dp; main() { cin>>N; vector<pair<int,int> >A(N); for(int i=0;i<N;i++) { cin>>A[i].first>>A[i].second; } sort(A.begin(),A.end(),[](pair<int,int>a,pair<int,int>b) { return a.first+a.second<b.first+b.second; }); dp[0]=1; for(pair<int,int>p:A) { int v=p.first,t=p.second; dp|=(dp<<20202-t>>20202-t)<<v; } int ans=20201; while(!dp[ans])ans--; cout<<ans<<endl; }