結果

問題 No.1876 Xor of Sum
ユーザー nephrologistnephrologist
提出日時 2022-03-24 13:55:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 1,050 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 94,860 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 23:48:23
合計ジャッジ時間 8,232 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 4 ms
5,376 KB
testcase_03 AC 142 ms
5,376 KB
testcase_04 AC 236 ms
5,376 KB
testcase_05 AC 29 ms
5,376 KB
testcase_06 AC 333 ms
5,376 KB
testcase_07 AC 37 ms
5,376 KB
testcase_08 AC 32 ms
5,376 KB
testcase_09 AC 225 ms
5,376 KB
testcase_10 AC 117 ms
5,376 KB
testcase_11 AC 281 ms
5,376 KB
testcase_12 AC 139 ms
5,376 KB
testcase_13 AC 207 ms
5,376 KB
testcase_14 AC 174 ms
5,376 KB
testcase_15 AC 196 ms
5,376 KB
testcase_16 AC 26 ms
5,376 KB
testcase_17 AC 310 ms
5,376 KB
testcase_18 AC 349 ms
5,376 KB
testcase_19 AC 349 ms
5,376 KB
testcase_20 AC 345 ms
5,376 KB
testcase_21 AC 345 ms
5,376 KB
testcase_22 AC 343 ms
5,376 KB
testcase_23 AC 344 ms
5,376 KB
testcase_24 AC 343 ms
5,376 KB
testcase_25 AC 348 ms
5,376 KB
testcase_26 AC 354 ms
5,376 KB
testcase_27 AC 343 ms
5,376 KB
testcase_28 AC 344 ms
5,376 KB
testcase_29 AC 347 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <iomanip> // setprecision
#include <numeric>
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int n;
int A[2020];

int main(){
    cin >> n;
    for (int i=0 ; i<n;i++){
        cin>>A[i];
        // A[i]=1;
    }
    bitset<4004000> B;
    B.set(0);
    for (int i=0 ; i<n;i++){
        // cout<<"count " <<B.count()<<endl;
        B^=(B<<A[i]);

    };
    // cout<<"count " <<B.count()<<endl;

    int ans=0;
    for (int i=0 ; i<n*2000+10;i++){
        // cout << i << endl;
        if (B[i]){
            // cout<< i <<endl;
            ans^=i;
        }

    }
    cout << ans <<endl;

}
0