結果

問題 No.2918 Divide Applicants Fairly
ユーザー cled0328cled0328
提出日時 2024-10-07 22:22:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 665 bytes
コンパイル時間 3,348 ms
コンパイル使用メモリ 225,208 KB
実行使用メモリ 40,148 KB
最終ジャッジ日時 2024-10-07 22:22:41
合計ジャッジ時間 14,882 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
16,128 KB
testcase_01 AC 37 ms
18,816 KB
testcase_02 AC 29 ms
16,212 KB
testcase_03 AC 2 ms
5,248 KB
testcase_04 AC 2 ms
5,248 KB
testcase_05 AC 63 ms
21,248 KB
testcase_06 AC 94 ms
23,808 KB
testcase_07 AC 39 ms
18,644 KB
testcase_08 AC 44 ms
18,816 KB
testcase_09 AC 181 ms
31,444 KB
testcase_10 AC 2 ms
5,248 KB
testcase_11 RE -
testcase_12 AC 177 ms
31,440 KB
testcase_13 AC 103 ms
26,320 KB
testcase_14 AC 70 ms
23,764 KB
testcase_15 AC 2 ms
6,820 KB
testcase_16 AC 2 ms
6,816 KB
testcase_17 AC 159 ms
31,440 KB
testcase_18 RE -
testcase_19 AC 29 ms
16,208 KB
testcase_20 AC 321 ms
39,000 KB
testcase_21 AC 177 ms
31,312 KB
testcase_22 AC 43 ms
18,772 KB
testcase_23 AC 182 ms
31,440 KB
testcase_24 AC 2 ms
6,816 KB
testcase_25 RE -
testcase_26 AC 63 ms
21,288 KB
testcase_27 AC 294 ms
38,988 KB
testcase_28 AC 77 ms
23,764 KB
testcase_29 AC 132 ms
26,320 KB
testcase_30 AC 2 ms
6,820 KB
testcase_31 AC 109 ms
26,316 KB
testcase_32 AC 2 ms
6,820 KB
testcase_33 AC 15 ms
13,776 KB
testcase_34 AC 17 ms
13,652 KB
testcase_35 AC 24 ms
16,080 KB
testcase_36 AC 272 ms
38,992 KB
testcase_37 AC 251 ms
36,436 KB
testcase_38 AC 244 ms
36,308 KB
testcase_39 AC 2 ms
6,820 KB
testcase_40 AC 270 ms
36,436 KB
testcase_41 AC 269 ms
36,432 KB
testcase_42 AC 289 ms
38,992 KB
testcase_43 AC 320 ms
38,996 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 2 ms
6,820 KB
testcase_47 AC 47 ms
18,688 KB
testcase_48 AC 181 ms
31,316 KB
testcase_49 AC 293 ms
36,340 KB
testcase_50 AC 55 ms
21,192 KB
testcase_51 AC 182 ms
31,360 KB
testcase_52 AC 250 ms
36,440 KB
testcase_53 AC 201 ms
33,920 KB
testcase_54 AC 209 ms
34,000 KB
testcase_55 AC 246 ms
34,004 KB
testcase_56 AC 220 ms
33,920 KB
testcase_57 AC 295 ms
39,040 KB
testcase_58 AC 207 ms
33,920 KB
testcase_59 AC 216 ms
33,920 KB
testcase_60 AC 100 ms
26,320 KB
testcase_61 AC 212 ms
33,920 KB
testcase_62 AC 165 ms
31,440 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
int n,r[40];
bitset<10400001> dp[26];
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>r[i];
	}
	if(n>=26){
		cout<<"0\n";
		return 0;
	}
	for(int i=0;i<n;i++){
		for(int j=1;j<26;j++){
			if(abs(j-13)>(n-i))continue;
			if(abs(j-13)>i)continue;
			dp[j-1]|=dp[j]>>r[i];
		}
		for(int j=26;j--;){
			if(abs(j-13)>(n-i))continue;
			if(abs(j-13)>i)continue;
			dp[j+1]|=dp[j]<<r[i];
		}
		dp[14][5200000+r[i]]=1;
	}
	int ans=800001;
	for(int i=4400000;i<6000001;i++)if(dp[13][i])ans=min(ans,abs(i-5200000));
	cout<<ans<<"\n";
}
0