結果
問題 |
No.2911 位相の公理
|
ユーザー |
![]() |
提出日時 | 2024-10-04 21:57:10 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 705 bytes |
コンパイル時間 | 258 ms |
コンパイル使用メモリ | 82,196 KB |
実行使用メモリ | 268,360 KB |
最終ジャッジ日時 | 2024-10-04 21:57:16 |
合計ジャッジ時間 | 5,031 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 TLE * 1 -- * 3 |
ソースコード
N, M = map(int, input().split()) S = [input() for _ in range(M)] for i in range(M): num = 0 for j in range(N): if S[i][j] == "1": num |= 1<<j S[i] = num SET = set(S) if (1<<N)-1 not in SET or 0 not in SET: exit(print("No")) for i in range(M-1): for j in range(i+1, M): if S[i]&S[j] not in SET: exit(print("No")) now = [False]*(1<<N) now[0] = True for i in range(M): nex = [False]*(1<<N) for j in range(1<<N): if not now[j]: continue nex[j] = now[j] nex[j|S[i]] = now[j] now = nex[:] for i in range(1<<N): if now[i] and i not in SET: print("No") break else: print("Yes")