結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー mayoko_mayoko_
提出日時 2015-04-17 06:59:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,304 bytes
コンパイル時間 1,292 ms
コンパイル使用メモリ 150,780 KB
実行使用メモリ 111,700 KB
最終ジャッジ日時 2023-09-17 16:31:36
合計ジャッジ時間 12,665 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 412 ms
79,920 KB
testcase_09 AC 57 ms
19,200 KB
testcase_10 AC 296 ms
61,708 KB
testcase_11 AC 197 ms
44,984 KB
testcase_12 AC 486 ms
92,592 KB
testcase_13 AC 530 ms
99,984 KB
testcase_14 AC 281 ms
58,488 KB
testcase_15 AC 583 ms
108,176 KB
testcase_16 AC 472 ms
90,488 KB
testcase_17 AC 519 ms
97,516 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 204 ms
111,596 KB
testcase_21 AC 621 ms
111,596 KB
testcase_22 AC 611 ms
111,700 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,384 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 583 ms
108,632 KB
testcase_34 AC 574 ms
107,384 KB
testcase_35 AC 595 ms
110,808 KB
testcase_36 AC 610 ms
110,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;

const int MAXN = 100100;
ll A[MAXN];

typedef long long number;
typedef vector<number> vec;
typedef vector<vec> matrix;

int matRank(matrix A) {
    const int n = A.size(), m = A[0].size();
    int r = 0;
    for (int i = 0; r < n && i < m; ++i) {
        int pivot = r;
        for (int j = r+1; j < n; ++j)
            if (abs(A[j][i]) > abs(A[pivot][i])) pivot = j;
        swap(A[pivot], A[r]);
        if (abs(A[r][i]) <= 0) continue;
        for (int k = m-1; k >= i; --k)
            A[r][k] /= A[r][i];
        for(int j = r+1; j < n; ++j)
            for(int k = i; k < m; ++k)
                A[j][k] -= A[r][k] * A[j][i];
        ++r;
    }
    return r;
}

ll pp(int num) {
    ll ret = 1;
    for (int i = 0; i < num; i++) ret *= 2;
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    matrix mat(N, vector<number>(64));
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        for (int j = 0; j < 64; j++) {
            mat[i][j] = A[i]&1;
            A[i] /= 2;
        }
    }
    cout << pp(matRank(mat)) << endl;
    return 0;
}
0