結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー 👑 nu50218nu50218
提出日時 2019-09-02 22:10:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,232 ms / 5,000 ms
コード長 1,027 bytes
コンパイル時間 1,501 ms
コンパイル使用メモリ 164,340 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 17:52:47
合計ジャッジ時間 22,955 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 875 ms
4,380 KB
testcase_09 AC 182 ms
4,376 KB
testcase_10 AC 666 ms
4,380 KB
testcase_11 AC 477 ms
4,376 KB
testcase_12 AC 1,015 ms
4,376 KB
testcase_13 AC 1,095 ms
4,376 KB
testcase_14 AC 629 ms
4,376 KB
testcase_15 AC 1,192 ms
4,380 KB
testcase_16 AC 990 ms
4,376 KB
testcase_17 AC 1,072 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,384 KB
testcase_20 AC 35 ms
4,380 KB
testcase_21 AC 1,231 ms
4,376 KB
testcase_22 AC 1,232 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 736 ms
4,376 KB
testcase_29 AC 1,015 ms
4,380 KB
testcase_30 AC 870 ms
4,380 KB
testcase_31 AC 747 ms
4,376 KB
testcase_32 AC 925 ms
4,376 KB
testcase_33 AC 1,195 ms
4,380 KB
testcase_34 AC 1,182 ms
4,380 KB
testcase_35 AC 1,219 ms
4,380 KB
testcase_36 AC 1,214 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using Int = unsigned long long;

int main() {
    Int N;
    cin >> N;
    Int A[N];

    for (Int i = 0; i < N; i++) cin >> A[i];

    for (Int i = 0; i < N; i++) {
        Int min_bit = 100;
        Int min_index = 0;
        for (Int j = i; j < N; j++) {
            for (Int k = 0; k < 64; k++) {
                if (A[j] & ((Int)1 << k)) {
                    if (k < min_bit) {
                        min_index = j;
                        min_bit = k;
                    }
                }
            }
        }
        if (min_bit == 100) break;
        swap(A[i], A[min_index]);
        for (Int j = i + 1; j < N; j++) {
            if (A[j] & ((Int)1 << min_bit)) {
                A[j] ^= A[i];
            }
        }
    }

    Int ans = 0;

    for (Int i = 0; i < N; i++) {
        bool flag = false;
        for (Int j = 0; j < 64; j++) {
            flag |= (A[i] & ((Int)1 << j));
        }
        ans += flag;
    }

    cout << ((Int)1 << ans) << endl;
}
0