結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-07-17 15:29:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 50 ms / 5,000 ms |
| コード長 | 1,104 bytes |
| コンパイル時間 | 365 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 66,560 KB |
| 最終ジャッジ日時 | 2024-09-17 21:27:20 |
| 合計ジャッジ時間 | 2,445 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
class xor_base():
def __init__(self):
self.K = 60
self._list = [0] * self.K
self.cnt = 0
def min_all(self, x):
for i in range(self.K - 1, -1, -1):
if (x >> i) & 1:
x ^= self._list[i]
return x
def add(self, x):
x = self.min_all(x)
if x == 0:
return
for i in range(self.K - 1, -1, -1):
if (x >> i) & 1:
for j in range(self.K):
if (self._list[j] >> i) & 1:
self._list[j] ^= x
self._list[i] = x
self.cnt += 1
return
def get(self, x):
now = 0
for i in range(self.K):
if (x >> i) & 1:
now ^= self._list[i]
return now
def __len__(self):
return self.cnt
def __str__(self):
return f"{self._list}, len = {self.cnt}"
N = int(input())
A = list(map(int, input().split()))
B = xor_base()
for a in A:
B.add(a)
print(2**len(B))
rlangevin