結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー maspy
提出日時 2020-03-03 15:49:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 603 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 50,840 KB
最終ジャッジ日時 2024-07-04 12:43:45
合計ジャッジ時間 24,753 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


# %%
import numpy as np

# %%


def row_transform_over_F2(A, highest=60):
    for k in range(highest, -1, -1):
        I = np.where((A >> k) == 1)[0]
        if len(I) == 0:
            continue
        i = I[0]
        x = A[i]
        A ^= ((A >> k) & 1) * x
        A[i] = x


# %%
N = int(readline())
A = np.array(read().split(), np.int64)


# %%
row_transform_over_F2(A, highest=61)


# %%
dim = np.count_nonzero(A)
print(2 ** dim)
0