結果
| 問題 |
No.184 たのしい排他的論理和(HARD)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-29 11:19:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 102 ms / 5,000 ms |
| コード長 | 745 bytes |
| コンパイル時間 | 1,660 ms |
| コンパイル使用メモリ | 168,336 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-21 22:32:22 |
| 合計ジャッジ時間 | 4,661 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
using R=double;
using ld = long double;
int INF = 1e9;
ll LINF = 1e18;
int mod = 1000000007;
int mod2 = 1;
using graph = vector<vector<int>>;
// using mint = modint1000000007;
int main(){
int n;cin >> n;
vector<ll> a(n);
rep(i,n) cin >> a[i];
int ans = 0;
rep(i,n){
if(a[i] == 0) continue;
ans++;
int x = 0;
while(1LL<<(x+1) <= a[i]) x++;
for(int j = i+1;j < n;j++){
if(a[j] & (1LL<<x)) a[j] ^= a[i];
}
}
cout << (1LL<< ans) << endl;
}