結果
| 問題 |
No.1560 majority x majority
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-06-02 06:40:02 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 380 bytes |
| コンパイル時間 | 289 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 159,784 KB |
| 最終ジャッジ日時 | 2024-12-23 00:57:19 |
| 合計ジャッジ時間 | 30,068 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 21 TLE * 5 |
ソースコード
N,M=map(int,input().split())
S=[list(map(int,input().split())) for n in range(N)]
dp=[0]*(1<<M)
dp[0]=1
for bit in range(1<<M):
idx=[n for n in range(N) if all(S[n][m] for m in range(M) if bit&1<<m)]
for m in range(M):
if bit&1<<m:
continue
if sum(S[n][m] for n in idx)*2>=len(idx):
dp[bit|1<<m]+=dp[bit]
ans=dp[(1<<M)-1]
print(ans)
vwxyz