結果

問題 No.2918 Divide Applicants Fairly
ユーザー 👑 potato167potato167
提出日時 2024-10-07 18:54:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,679 ms / 2,000 ms
コード長 680 bytes
コンパイル時間 2,010 ms
コンパイル使用メモリ 203,180 KB
実行使用メモリ 168,708 KB
最終ジャッジ日時 2024-10-07 21:08:33
合計ジャッジ時間 58,252 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 300 ms
168,448 KB
testcase_01 AC 416 ms
168,456 KB
testcase_02 AC 359 ms
168,576 KB
testcase_03 AC 9 ms
36,480 KB
testcase_04 AC 9 ms
36,480 KB
testcase_05 AC 620 ms
168,576 KB
testcase_06 AC 687 ms
168,576 KB
testcase_07 AC 420 ms
168,576 KB
testcase_08 AC 489 ms
168,456 KB
testcase_09 AC 1,142 ms
168,448 KB
testcase_10 AC 10 ms
36,352 KB
testcase_11 AC 1,614 ms
168,456 KB
testcase_12 AC 1,075 ms
168,576 KB
testcase_13 AC 815 ms
168,448 KB
testcase_14 AC 682 ms
168,448 KB
testcase_15 AC 9 ms
36,352 KB
testcase_16 AC 8 ms
36,480 KB
testcase_17 AC 1,097 ms
168,460 KB
testcase_18 AC 1,606 ms
168,460 KB
testcase_19 AC 354 ms
168,456 KB
testcase_20 AC 1,530 ms
168,576 KB
testcase_21 AC 1,070 ms
168,448 KB
testcase_22 AC 426 ms
168,448 KB
testcase_23 AC 1,151 ms
168,448 KB
testcase_24 AC 9 ms
36,608 KB
testcase_25 AC 1,679 ms
168,708 KB
testcase_26 AC 623 ms
168,576 KB
testcase_27 AC 1,468 ms
168,448 KB
testcase_28 AC 687 ms
168,460 KB
testcase_29 AC 811 ms
168,576 KB
testcase_30 AC 8 ms
36,352 KB
testcase_31 AC 876 ms
168,456 KB
testcase_32 AC 10 ms
36,480 KB
testcase_33 AC 148 ms
168,448 KB
testcase_34 AC 210 ms
168,448 KB
testcase_35 AC 273 ms
168,448 KB
testcase_36 AC 1,472 ms
168,448 KB
testcase_37 AC 1,408 ms
168,456 KB
testcase_38 AC 1,348 ms
168,460 KB
testcase_39 AC 9 ms
36,352 KB
testcase_40 AC 1,240 ms
168,456 KB
testcase_41 AC 1,290 ms
168,428 KB
testcase_42 AC 1,354 ms
168,380 KB
testcase_43 AC 1,418 ms
168,448 KB
testcase_44 AC 1,469 ms
168,576 KB
testcase_45 AC 1,563 ms
168,448 KB
testcase_46 AC 9 ms
36,480 KB
testcase_47 AC 480 ms
168,584 KB
testcase_48 AC 1,165 ms
168,452 KB
testcase_49 AC 1,333 ms
168,368 KB
testcase_50 AC 548 ms
168,584 KB
testcase_51 AC 1,134 ms
168,576 KB
testcase_52 AC 1,400 ms
168,576 KB
testcase_53 AC 1,142 ms
168,448 KB
testcase_54 AC 1,189 ms
168,448 KB
testcase_55 AC 1,272 ms
168,576 KB
testcase_56 AC 1,266 ms
168,456 KB
testcase_57 AC 1,464 ms
168,448 KB
testcase_58 AC 1,270 ms
168,456 KB
testcase_59 AC 1,289 ms
168,448 KB
testcase_60 AC 825 ms
168,456 KB
testcase_61 AC 1,263 ms
168,460 KB
testcase_62 AC 1,070 ms
168,456 KB
testcase_63 AC 1,069 ms
168,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i=(int)(a);i<(int)(b);i++)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    
	const int M = 13;
    const int X = 800000 * M;
    const int Y = X * M * 2 + 1;
    const int H = X * M;
    bitset<Y> dp;
    int N;
    cin >> N;
    if (N >= 26){
    	cout << "0\n";
    	return 0;
    }
    rep(i, 0, N){
        int a;
        cin >> a;
        a += X;
        dp = (dp | (dp << a) | (dp >> a));
        dp[a + H] = true;
        dp[H - a] = true;
    }
    rep(i, 0, 1 << 30){
        if (dp[i + H] | dp[H - i]){
            cout << i << "\n";
            break;
        }
    }
}
0