結果
問題 | No.1560 majority x majority |
ユーザー |
![]() |
提出日時 | 2021-07-19 06:55:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 239 ms / 2,000 ms |
コード長 | 421 bytes |
コンパイル時間 | 301 ms |
コンパイル使用メモリ | 81,716 KB |
実行使用メモリ | 79,636 KB |
最終ジャッジ日時 | 2024-07-16 15:16:06 |
合計ジャッジ時間 | 4,448 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 26 |
ソースコード
n,m = map(int,input().split()) r = [0]*m for i in range(n): for j,rj in enumerate(map(int,input().split())): r[j] |= rj<<i M = 1<<m dp = [(1<<n)-1] for i in range(m): dp += [x&r[i] for x in dp] *cnt, = map(lambda s:bin(s).count("1"), dp) A = [0]*M A[0] = 1 for S in range(M): for i in range(m): nS = S|1<<i if S>>i&1==0 and cnt[S] <= 2*cnt[nS]: A[nS] += A[S] print(A[-1])