結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー h_nosonh_noson
提出日時 2016-03-15 19:54:46
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 921 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 63,404 KB
実行使用メモリ 4,432 KB
最終ジャッジ日時 2023-09-17 17:28:18
合計ジャッジ時間 4,569 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
4,376 KB
testcase_01 AC 22 ms
4,380 KB
testcase_02 AC 110 ms
4,380 KB
testcase_03 AC 75 ms
4,380 KB
testcase_04 AC 89 ms
4,376 KB
testcase_05 AC 89 ms
4,380 KB
testcase_06 AC 21 ms
4,380 KB
testcase_07 AC 89 ms
4,432 KB
testcase_08 AC 75 ms
4,376 KB
testcase_09 AC 23 ms
4,376 KB
testcase_10 AC 59 ms
4,380 KB
testcase_11 AC 45 ms
4,380 KB
testcase_12 AC 85 ms
4,376 KB
testcase_13 AC 92 ms
4,380 KB
testcase_14 AC 57 ms
4,376 KB
testcase_15 AC 99 ms
4,376 KB
testcase_16 AC 84 ms
4,380 KB
testcase_17 AC 89 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 16 ms
4,380 KB
testcase_20 AC 36 ms
4,376 KB
testcase_21 AC 101 ms
4,376 KB
testcase_22 AC 102 ms
4,380 KB
testcase_23 AC 12 ms
4,400 KB
testcase_24 AC 14 ms
4,376 KB
testcase_25 AC 13 ms
4,376 KB
testcase_26 AC 16 ms
4,380 KB
testcase_27 AC 15 ms
4,380 KB
testcase_28 AC 68 ms
4,380 KB
testcase_29 AC 97 ms
4,376 KB
testcase_30 AC 97 ms
4,376 KB
testcase_31 AC 86 ms
4,376 KB
testcase_32 AC 109 ms
4,380 KB
testcase_33 AC 99 ms
4,376 KB
testcase_34 AC 98 ms
4,376 KB
testcase_35 AC 101 ms
4,376 KB
testcase_36 AC 100 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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<100000> 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 = 100000;
        int index;
        REP (j,i,61) {
            for (k = 0; k < 100000 && !bs[j][k]; k++);
            if (k < mn) {
                mn = k;
                index = j;
            }
        }
        swap(bs[i],bs[index]);
        if (mn == 100000)
            break;
        REP (j,i+1,61) {
            if (bs[j][mn])
                bs[j] ^= bs[i];
        }
    }
    cout << (1LL << i) << endl;
    return 0;
}
0