結果

問題 No.54 Happy Hallowe'en
ユーザー kotatsugamekotatsugame
提出日時 2021-01-10 06:45:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 499 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 67,556 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-30 13:55:38
合計ジャッジ時間 1,325 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 4 ms
6,948 KB
testcase_05 AC 4 ms
6,940 KB
testcase_06 AC 6 ms
6,940 KB
testcase_07 AC 7 ms
6,940 KB
testcase_08 AC 9 ms
6,944 KB
testcase_09 AC 10 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 8 ms
6,940 KB
testcase_13 AC 10 ms
6,940 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main()
      | ^~~~

ソースコード

diff #

#include<cstdio>
#include<algorithm>
#include<vector>
#include<bitset>
using namespace std;
int N;
using bit=bitset<20000>;
bit dp;
int V[10000],T[10000];
pair<int,int>idw[10000];
main()
{
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	{
		scanf("%d%d",&V[i],&T[i]);
		idw[i].first=V[i]+T[i];
		idw[i].second=i;
	}
	sort(idw,idw+N);
	dp[19999]=1;
	for(int i=0;i<N;i++)
	{
		int v=V[idw[i].second],t=T[idw[i].second];
		dp|=dp>>20000-t<<20000-t-v;
	}
	int ans=19999-dp._Find_first();
	printf("%d\n",ans);
}
0