結果

問題 No.1876 Xor of Sum
ユーザー cologne
提出日時 2022-03-13 10:19:36
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 283 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 2,794 ms
コンパイル使用メモリ 122,496 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-17 20:04:09
合計ジャッジ時間 8,960 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bitset>
#include <iostream>
#include <vector>

using namespace std;
using Line = bitset<2000 * 2000 + 1>;
int main()
{
    int N;
    cin >> N;
    Line l = 0;
    l[0] = 1;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        l ^= l << a;
    }
    int ans = 0;
    for (int i = 0; i < (int)l.size(); i++)
    {
        if (l[i])
            ans ^= i;
    }
    cout << ans << endl;
}
0