結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー chocoruskchocorusk
提出日時 2019-10-21 23:09:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 1,496 bytes
コンパイル時間 908 ms
コンパイル使用メモリ 110,952 KB
実行使用メモリ 4,752 KB
最終ジャッジ日時 2023-09-17 17:58:38
合計ジャッジ時間 3,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 38 ms
4,376 KB
testcase_09 AC 10 ms
4,380 KB
testcase_10 AC 29 ms
4,376 KB
testcase_11 AC 22 ms
4,376 KB
testcase_12 AC 45 ms
4,376 KB
testcase_13 AC 48 ms
4,508 KB
testcase_14 AC 28 ms
4,380 KB
testcase_15 AC 52 ms
4,692 KB
testcase_16 AC 44 ms
4,468 KB
testcase_17 AC 46 ms
4,432 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,384 KB
testcase_20 AC 11 ms
4,664 KB
testcase_21 AC 53 ms
4,624 KB
testcase_22 AC 53 ms
4,672 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 33 ms
4,376 KB
testcase_29 AC 45 ms
4,396 KB
testcase_30 AC 40 ms
4,376 KB
testcase_31 AC 34 ms
4,380 KB
testcase_32 AC 42 ms
4,380 KB
testcase_33 AC 52 ms
4,624 KB
testcase_34 AC 51 ms
4,688 KB
testcase_35 AC 53 ms
4,752 KB
testcase_36 AC 53 ms
4,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<typename T>
vector<T> Gauss_Jordan(const vector<T> &v, const int &MAX){ //v[i]<2^MAX
    int n=v.size();
    vector<T> ret=v;
    int d=0;
    for(int k=MAX-1; k>=0; k--){
        int p=-1;
        for(int i=d; i<n; i++){
            if((ret[i]>>k)&1){
                p=i;
                break;
            }
        }
        if(p==-1) continue;
        swap(ret[d], ret[p]);
        for(int i=0; i<n; i++){
            if(i==d) continue;
            if((ret[i]>>k)&1) ret[i]^=ret[d];
        }
        d++;
    }
    return ret;
}
template<typename T>
int matrix_rank(const vector<T> &v, const int &MAX){
    int n=v.size();
    vector<T> a=Gauss_Jordan(v, MAX);
    for(int i=0; i<n; i++){
        if(a[i]==0) return i;
    }
    return n;
}

int main()
{
    int n;
    scanf("%d", &n);
    using ull=unsigned long long;
    const int MAX=61;
    vector<ull> a(n);
    for(int i=0; i<n; i++){
        scanf("%llu", &a[i]);
    }
    printf("%llu\n", 1ull<<matrix_rank(a, MAX));
    return 0;
}
0