結果
| 問題 |
No.231 めぐるはめぐる (1)
|
| コンテスト | |
| ユーザー |
codershifth
|
| 提出日時 | 2016-01-16 14:18:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,523 bytes |
| コンパイル時間 | 2,282 ms |
| コンパイル使用メモリ | 162,920 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-19 19:57:35 |
| 合計ジャッジ時間 | 3,855 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 11 |
ソースコード
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define RANGE(vec) (vec).begin(),(vec).end()
using namespace std;
// uint64_t 吐き出し法
std::vector<uint64_t>
sweep_uint64(const std::vector<uint64_t> &A)
{
auto a = A;
int n = a.size();
int row = 0;
// O(64*N)
for (int col = 63; col >= 0; --col)
{
int pivot = row; //row 行目以降だけ見る
// 先頭から col 番目のビットが立っている a[i] を見つける
while ( pivot < n && !(a[pivot] & 1ULL<<col) )
++pivot;
// col 番目にビットが立つ a はなかった
if (pivot == n)
continue;
swap(a[row], a[pivot]);
for (int i = row+1; i < n; ++i)
{
if ( a[i] & 1ULL<<col)
a[i] ^= a[row];
}
++row;
}
return a;
}
class HappyXorHard
{
public:
void solve(void) {
int N;
cin>>N;
vector<uint64_t> A(N);
REP(i,N) cin>>A[i];
A = sweep_uint64(A);
int k = count_if(RANGE(A), [](uint64_t a) { return (a>0); });
cout<<(1LL<<k)<<endl;
}
};
#if 1
int main(int argc, char *argv[])
{
ios::sync_with_stdio(false);
auto obj = new HappyXorHard();
obj->solve();
delete obj;
return 0;
}
#endif
codershifth