結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー parukiparuki
提出日時 2016-08-31 15:37:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,426 bytes
コンパイル時間 1,564 ms
コンパイル使用メモリ 170,528 KB
実行使用メモリ 58,060 KB
最終ジャッジ日時 2023-09-17 17:35:55
合計ジャッジ時間 7,418 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 118 ms
57,692 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
4,380 KB
testcase_25 WA -
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int rankMat(vector<vector<int> > A){
    int n = (int)A.size(), m = (int)A[0].size();

    for(int i = 0; i < min(n, m); ++i){
        for(int j = i; j < n; ++j){
            if(A[j][i]){
                swap(A[i], A[j]);
                break;
            }
        }
        if(A[i][i] == 0){
            continue;
        }
        for(int j = 0; j < n; ++j){
            if(i!=j && A[j][i]){
                for(int k = i; k < m; ++k){
                    A[j][k] ^= A[i][k];
                }
            }
        }
    }

    int r = n;
    for(int i = 0; i < n; ++i)
        if(accumulate(all(A[i]), 0) == 0)--r;

    return r;
}

int main(){
    const int M = 61;
    int N;
    cin >> N;
    vector<vi> A(N, vi(M));
    rep(i, N){
        int a; scanf("%d", &a);
        rep(j, M)if(a >> j & 1)A[i][j] = 1;
    }
    int r = rankMat(A);
    assert(r <= M);
    ll ans = 1ll << r;
    cout << ans << endl;
}
0