結果

問題 No.943 取り調べ
ユーザー TakoKurageTakoKurage
提出日時 2019-12-16 11:09:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 78,864 KB
最終ジャッジ日時 2023-09-15 17:29:49
合計ジャッジ時間 5,233 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,272 KB
testcase_01 AC 68 ms
71,256 KB
testcase_02 AC 68 ms
71,244 KB
testcase_03 AC 67 ms
71,436 KB
testcase_04 AC 342 ms
78,028 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 67 ms
71,492 KB
testcase_08 AC 343 ms
77,876 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 168 ms
78,260 KB
testcase_12 AC 68 ms
71,560 KB
testcase_13 AC 92 ms
76,756 KB
testcase_14 WA -
testcase_15 AC 71 ms
71,284 KB
testcase_16 AC 69 ms
71,328 KB
testcase_17 AC 202 ms
78,400 KB
testcase_18 AC 69 ms
71,436 KB
testcase_19 AC 91 ms
76,752 KB
testcase_20 AC 70 ms
71,640 KB
testcase_21 AC 69 ms
71,392 KB
testcase_22 WA -
testcase_23 AC 410 ms
78,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
X = [int(input().replace(" ", "")[::-1], 2) for _ in range(N)]
A = [int(i) for i in input().split()]

complete = 2 ** N - 1

ans = float("inf")
for state in range(2 ** N):

    cand = sum(a for i, a in enumerate(A) if state >> i & 1)

    for i, x in enumerate(X):
        if state & x == x:
            state |= 1 << i

    for i, x in enumerate(X):
        if state & x == x:
            state |= 1 << i

    if state != complete:
        continue

    ans = min(ans, cand)

print(ans)
0