結果

問題 No.2911 位相の公理
ユーザー H3PO4
提出日時 2024-10-04 21:39:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 596 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,192 KB
実行使用メモリ 82,308 KB
最終ジャッジ日時 2024-10-04 21:39:28
合計ジャッジ時間 4,316 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(N: int, M: int, S: list[int]) -> bool:
    S_st = set(S)
    # 条件1
    if (1 << N) - 1 not in S_st:
        return False
    # 条件2
    for i in range(M):
        for j in range(i + 1, M):
            if S[i] & S[j] not in S_st:
                return False
    # 条件3
    for b in range(1 << M):
        x = 0
        for i in range(M):
            if b & (1 << i):
                x |= S[i]
        if x not in S_st:
            return False
    return True


N, M = map(int, input().split())
S = [int(input(), 2) for _ in range(M)]
print("Yes" if solve(N, M, S) else "No")
0