結果

問題 No.1560 majority x majority
ユーザー convexineqconvexineq
提出日時 2021-07-19 07:02:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 88,120 KB
最終ジャッジ日時 2023-09-23 15:55:29
合計ジャッジ時間 5,207 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 211 ms
88,120 KB
testcase_01 AC 216 ms
87,744 KB
testcase_02 AC 68 ms
71,424 KB
testcase_03 AC 212 ms
86,692 KB
testcase_04 AC 201 ms
86,164 KB
testcase_05 AC 150 ms
85,196 KB
testcase_06 AC 93 ms
78,092 KB
testcase_07 AC 80 ms
77,176 KB
testcase_08 AC 145 ms
83,812 KB
testcase_09 AC 106 ms
78,456 KB
testcase_10 AC 75 ms
75,936 KB
testcase_11 AC 80 ms
76,940 KB
testcase_12 AC 74 ms
76,176 KB
testcase_13 AC 82 ms
76,752 KB
testcase_14 AC 73 ms
76,056 KB
testcase_15 AC 100 ms
78,184 KB
testcase_16 AC 73 ms
75,880 KB
testcase_17 AC 141 ms
84,088 KB
testcase_18 AC 98 ms
80,016 KB
testcase_19 AC 74 ms
75,880 KB
testcase_20 AC 75 ms
76,040 KB
testcase_21 AC 75 ms
75,924 KB
testcase_22 AC 108 ms
81,272 KB
testcase_23 AC 73 ms
75,672 KB
testcase_24 AC 72 ms
76,012 KB
testcase_25 AC 102 ms
80,064 KB
testcase_26 AC 66 ms
71,356 KB
testcase_27 AC 68 ms
71,188 KB
testcase_28 AC 68 ms
71,264 KB
testcase_29 AC 70 ms
71,568 KB
testcase_30 AC 77 ms
76,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,*R = map(int,open(0).read().split())
r = [int("".join(map(str,R[i::m])),2) for i in range(m)]

dp = [(1<<n)-1]
for i in range(m):
    dp += [x&r[i] for x in dp]
*c, = map(lambda s:bin(s).count("1"), dp)

M = 1<<m
A = [0]*M
A[0] = 1
for S in range(M):
    for i in range(m):
        T = S|1<<i
        if S>>i&1==0 and c[S] <= 2*c[T]:
            A[T] += A[S]
print(A[-1])
0