結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー NoneNone
提出日時 2021-06-02 23:15:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 905 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 92,228 KB
最終ジャッジ日時 2024-04-27 15:33:13
合計ジャッジ時間 5,433 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,016 KB
testcase_01 AC 32 ms
52,932 KB
testcase_02 AC 32 ms
53,016 KB
testcase_03 AC 33 ms
52,128 KB
testcase_04 AC 33 ms
51,888 KB
testcase_05 AC 33 ms
52,448 KB
testcase_06 AC 33 ms
53,220 KB
testcase_07 AC 34 ms
52,508 KB
testcase_08 AC 98 ms
82,804 KB
testcase_09 AC 54 ms
66,120 KB
testcase_10 AC 93 ms
77,956 KB
testcase_11 AC 77 ms
72,324 KB
testcase_12 AC 114 ms
87,420 KB
testcase_13 AC 113 ms
87,960 KB
testcase_14 AC 82 ms
76,864 KB
testcase_15 AC 122 ms
90,404 KB
testcase_16 AC 108 ms
85,340 KB
testcase_17 AC 112 ms
87,304 KB
testcase_18 AC 36 ms
58,992 KB
testcase_19 AC 33 ms
52,892 KB
testcase_20 AC 53 ms
78,864 KB
testcase_21 AC 125 ms
92,220 KB
testcase_22 AC 131 ms
92,228 KB
testcase_23 AC 40 ms
58,820 KB
testcase_24 AC 33 ms
52,688 KB
testcase_25 AC 35 ms
59,520 KB
testcase_26 AC 33 ms
52,400 KB
testcase_27 AC 32 ms
52,396 KB
testcase_28 AC 90 ms
81,360 KB
testcase_29 AC 112 ms
88,200 KB
testcase_30 AC 102 ms
85,832 KB
testcase_31 AC 94 ms
83,268 KB
testcase_32 AC 110 ms
85,280 KB
testcase_33 AC 123 ms
90,640 KB
testcase_34 AC 120 ms
90,284 KB
testcase_35 AC 128 ms
92,048 KB
testcase_36 AC 131 ms
92,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Gauss2(mat):
    """
    F_2 用
    :param mat: [bit1,bit2,...]
    :return: rank, gaussの標準形
    """
    H,W=len(mat),max(mat).bit_length()
    res=[mat[i] for i in range(H)]
    rank = 0
    for w in range(W):
        pivot = -1
        for h in range(rank,H):
            if res[h] & (1<<w):
                pivot = h
                break
        else:
            continue
        res[rank],res[pivot] =res[pivot],res[rank]
        for h in range(H):
            if h == rank: continue
            if not (res[h]&(1<<w)):
                continue
            res[h] ^= res[rank]
        rank += 1
    return rank, res

def bit_rep(bit,N):
    return format(bit, "0" + str(N) + "b")

############################################################################
import sys
input = sys.stdin.readline


N=int(input())
A=list(map(int, input().split()))
rank,gauss=Gauss2(A)
print(pow(2,rank))
0