結果
問題 | No.54 Happy Hallowe'en |
ユーザー | kotatsugame |
提出日時 | 2021-01-10 06:43:50 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 11 ms / 5,000 ms |
コード長 | 520 bytes |
コンパイル時間 | 699 ms |
コンパイル使用メモリ | 67,824 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-04-30 13:36:56 |
合計ジャッジ時間 | 1,446 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 6 ms
6,812 KB |
testcase_01 | AC | 6 ms
6,940 KB |
testcase_02 | AC | 5 ms
6,944 KB |
testcase_03 | AC | 5 ms
6,940 KB |
testcase_04 | AC | 7 ms
6,944 KB |
testcase_05 | AC | 8 ms
6,940 KB |
testcase_06 | AC | 8 ms
6,944 KB |
testcase_07 | AC | 9 ms
6,940 KB |
testcase_08 | AC | 11 ms
6,944 KB |
testcase_09 | AC | 11 ms
6,944 KB |
testcase_10 | AC | 6 ms
6,944 KB |
testcase_11 | AC | 6 ms
6,944 KB |
testcase_12 | AC | 9 ms
6,940 KB |
testcase_13 | AC | 11 ms
6,944 KB |
testcase_14 | AC | 5 ms
6,944 KB |
testcase_15 | AC | 6 ms
6,940 KB |
testcase_16 | AC | 6 ms
6,940 KB |
testcase_17 | AC | 5 ms
6,944 KB |
testcase_18 | AC | 6 ms
6,940 KB |
コンパイルメッセージ
main.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 10 | main() | ^~~~
ソースコード
#include<cstdio> #include<algorithm> #include<vector> #include<bitset> using namespace std; int N; using bit=bitset<20000>; bit dp; pair<int,int>A[10000]; main() { scanf("%d",&N); for(int i=0;i<N;i++) { scanf("%d%d",&A[i].first,&A[i].second); } sort(A,A+N,[](const pair<int,int>&a,const pair<int,int>&b) { return a.first+a.second<b.first+b.second; }); dp[19999]=1; for(pair<int,int>p:A) { int v=p.first,t=p.second; dp|=dp>>20000-t<<20000-t-v; } int ans=19999-dp._Find_first(); printf("%d\n",ans); }