結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー h_nosonh_noson
提出日時 2016-03-15 19:54:05
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 917 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 64,304 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-17 17:27:39
合計ジャッジ時間 6,382 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8

typedef long long ll;

int main() {
    int i, j, k, n;
    bitset<10000> bs[61] {};
    cin >> n;
    rep (i,n) {
        ll a;
        cin >> a;
        rep (j,61) bs[j][i] = a&(1LL<<j);
    }
    rep (i,61) {
        int mn = 10000;
        int index;
        REP (j,i,61) {
            for (k = 0; k < 10000 && !bs[j][k]; k++);
            if (k < mn) {
                mn = k;
                index = j;
            }
        }
        swap(bs[i],bs[index]);
        if (mn == 10000)
            break;
        REP (j,i+1,61) {
            if (bs[j][mn])
                bs[j] ^= bs[i];
        }
    }
    cout << (1LL << i) << endl;
    return 0;
}
0