結果
問題 | No.1560 majority x majority |
ユーザー |
|
提出日時 | 2022-11-27 16:20:32 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 583 bytes |
コンパイル時間 | 361 ms |
コンパイル使用メモリ | 81,976 KB |
実行使用メモリ | 252,236 KB |
最終ジャッジ日時 | 2024-10-04 05:42:43 |
合計ジャッジ時間 | 9,359 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 25 TLE * 1 |
ソースコード
import sysinput = sys.stdin.buffer.readlineN, M = map(int, input().split())S = tuple(tuple(map(int, input().split())) for _ in range(N))dp = [0] * (1 << M)alive = [[] for _ in range(1 << M)]dp[0] = 1alive[0] = list(range(N))for b in range(1 << M):for i in range(M):if (b >> i) & 1:continueaffirmative = sum(S[x][i] for x in alive[b])c = b | (1 << i)if affirmative >= len(alive[b]) - affirmative:dp[c] += dp[b]if not alive[c]:alive[c] = [x for x in alive[b] if S[x][i]]print(dp[-1])