結果

問題 No.3229 Liar Game Comibination
ユーザー titia
提出日時 2025-08-13 01:57:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 635 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2025-08-13 01:57:40
合計ジャッジ時間 8,218 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,M,K=map(int,input().split())

A=[]

for i in range(M):
    S=input().strip()
    x=int(S,2)

    A.append(x)
    
# xorの掃き出し法・基底

BASE=[]

def sweep(x):
    for b in BASE:
        if b^x<x:
            x=b^x
    return x


for x in sorted(A):
    k=sweep(x)
    if k!=0: # 掃き出した値が0でないなら基底に入れる。
        BASE.append(k)

ANS=len(BASE)

print(pow(2,N-ANS,K))
0