結果
| 問題 |
No.54 Happy Hallowe'en
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-10 06:43:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 5,000 ms |
| コード長 | 520 bytes |
| コンパイル時間 | 625 ms |
| コンパイル使用メモリ | 67,268 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-20 08:48:45 |
| 合計ジャッジ時間 | 1,502 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
コンパイルメッセージ
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);
}