結果

問題 No.184 たのしい排他的論理和(HARD)
コンテスト
ユーザー h_noson
提出日時 2016-03-15 19:54:46
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 921 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 420 ms
コンパイル使用メモリ 84,704 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-25 19:51:13
合計ジャッジ時間 2,988 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/exception_ptr.h:41,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/exception:168,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ios:43,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:43,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
                 from main.cpp:1:
In function 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = bitset<100000>]',
    inlined from 'int main()' at main.cpp:34:13:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/move.h:237:7: warning: 'index' may be used uninitialized [-Wmaybe-uninitialized]
  237 |       __b = _GLIBCXX_MOVE(__tmp);
      |       ^~~
main.cpp: In function 'int main()':
main.cpp:26:13: note: 'index' was declared here
   26 |         int index;
      |             ^~~~~

ソースコード

diff #
raw source code

#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