結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー lloyz
提出日時 2023-10-08 17:55:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 181 ms / 5,000 ms
コード長 634 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 140,728 KB
最終ジャッジ日時 2024-07-26 18:10:12
合計ジャッジ時間 5,532 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

def gauss_jordan(A):
    # F2 上の Gauss Jordan の掃き出し法
    # 基底を取り出す
    # 引数を破壊的に変更する
    idx = 0
    for i in range(61, -1, -1):
        for j, a in enumerate(A[idx:], idx):
            if a>>i & 1:
                break
        else:
            continue
        A[idx], A[j] = A[j], A[idx]
        for j in range(len(A)):
            if j != idx and A[j]>>i & 1:
                A[j] ^= a
        idx += 1
    assert not any(A[idx:])
    del A[idx:]
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int, input().split()))
gauss_jordan(A)
print(pow(2, len(A)))
0