結果

問題 No.1876 Xor of Sum
ユーザー 00 00
提出日時 2022-05-03 17:32:15
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 382 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 2,821 ms
コンパイル使用メモリ 245,796 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 14:21:18
合計ジャッジ時間 11,082 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int mxN = 4e6 +5;
int main(){
    int n;
    cin >> n;
    bitset <mxN> dp;
    dp[0] = 1;
    for(int i = 0, a;i < n;i++){
        cin >> a;
        dp ^= (dp << a);
    }

    int ans = 0;
    for(int i = 0;i < mxN;i++)
        if(dp[i]) ans ^= i;

    cout << ans << "\n";

    return 0;
}
0