結果

問題 No.2911 位相の公理
ユーザー rlangevin
提出日時 2024-10-04 21:38:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 483 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 610 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-10-04 21:38:26
合計ジャッジ時間 3,890 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x):
    v = 0
    now = 1
    while x:
        v += int(x[-1]) * now
        now *= 2
        x.pop()
    return v

N, M = map(int, input().split())
S = set()
for i in range(M):
    s = list(input())
    S.add(f(s))
    
N2 = 1 << N
if N2 - 1 not in S:
    print("No")
    exit()
    
for s1 in S:
    for s2 in S:
        if s1 & s2 not in S:
            print("No")
            exit()
      
L = list(S)  
for ss in range(N2):
    temp = 0
    for i in range(N):
        if (ss >> i) & 1:
            temp |= L[i]
    if temp not in S:
        print("No")
        exit()
        
print("Yes")
0