結果
| 問題 |
No.184 たのしい排他的論理和(HARD)
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2022-12-26 04:32:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 117 ms / 5,000 ms |
| コード長 | 887 bytes |
| コンパイル時間 | 988 ms |
| コンパイル使用メモリ | 108,652 KB |
| 最終ジャッジ日時 | 2025-02-09 21:01:33 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>
using namespace std;
int main(){
long long N, rank=0;
cin >> N;
deque<long long> A(N);
for (int i=0; i<N; i++) cin >> A[i];
for (int i=0; i<=60; i++){
bool f=0;
if (1LL<<i & A[rank]) f = 1;
else{
for (int j=rank+1; j<N; j++){
if (1LL<<i & A[j]){
swap(A[rank], A[j]);
f = 1;
break;
}
}
}
if (f){
for (int j=rank+1; j<N; j++){
if (1LL<<i & A[j]) A[j] ^= A[rank];
}
rank++;
}
}
cout << (1LL<<rank) << endl;
return 0;
}
srjywrdnprkt