結果

問題 No.2918 Divide Applicants Fairly
ユーザー 👑 potato167
提出日時 2024-10-07 18:54:08
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,934 ms / 2,000 ms
コード長 680 bytes
コンパイル時間 5,807 ms
コンパイル使用メモリ 211,804 KB
実行使用メモリ 168,708 KB
最終ジャッジ日時 2025-03-24 19:29:40
合計ジャッジ時間 72,085 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

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