結果

問題 No.1560 majority x majority
ユーザー hir355hir355
提出日時 2021-06-25 23:21:59
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 513 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 79,060 KB
最終ジャッジ日時 2023-09-07 15:03:37
合計ジャッジ時間 16,882 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 1,827 ms
79,012 KB
testcase_02 AC 77 ms
71,456 KB
testcase_03 AC 815 ms
78,972 KB
testcase_04 AC 391 ms
79,060 KB
testcase_05 AC 993 ms
78,800 KB
testcase_06 AC 226 ms
77,552 KB
testcase_07 AC 160 ms
78,392 KB
testcase_08 AC 717 ms
78,812 KB
testcase_09 AC 364 ms
77,940 KB
testcase_10 AC 113 ms
77,932 KB
testcase_11 AC 166 ms
78,148 KB
testcase_12 AC 132 ms
78,188 KB
testcase_13 AC 168 ms
78,116 KB
testcase_14 AC 137 ms
78,292 KB
testcase_15 AC 300 ms
77,796 KB
testcase_16 AC 134 ms
78,400 KB
testcase_17 AC 847 ms
78,912 KB
testcase_18 AC 269 ms
78,808 KB
testcase_19 AC 110 ms
77,168 KB
testcase_20 AC 127 ms
78,100 KB
testcase_21 AC 135 ms
78,360 KB
testcase_22 AC 453 ms
78,804 KB
testcase_23 AC 114 ms
78,056 KB
testcase_24 AC 129 ms
77,928 KB
testcase_25 AC 385 ms
78,572 KB
testcase_26 AC 80 ms
71,232 KB
testcase_27 AC 77 ms
71,388 KB
testcase_28 AC 75 ms
71,340 KB
testcase_29 AC 82 ms
76,380 KB
testcase_30 AC 92 ms
76,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(n)]
dp = [0] * (1 << m)
dp[0] = 1
for i in range(1 << m):
    cnt = [0] * m
    t = 0
    for k in range(n):
        for j in range(m):
            if s[k][j] == 0 and (i >> j) & 1:
                break
        else:
            t += 1
            for j in range(m):
                cnt[j] += s[k][j]
    for j in range(m):
        if((i >> j) & 1) == 0 and cnt[j] * 2 >= t:
            dp[i | (1 << j)] += dp[i]
print(dp[-1])
0