結果

問題 No.943 取り調べ
ユーザー titiatitia
提出日時 2019-12-06 03:04:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 599 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 81,688 KB
最終ジャッジ日時 2023-08-24 19:37:03
合計ジャッジ時間 4,129 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
78,448 KB
testcase_01 AC 75 ms
71,228 KB
testcase_02 AC 76 ms
71,460 KB
testcase_03 AC 76 ms
71,200 KB
testcase_04 AC 585 ms
77,188 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())

X=[set() for i in range(N)]

for i in range(N):
    L=list(map(int,input().split()))
    
    for j in range(N):
        if L[j]==1:
            X[i].add(j)
        
A=list(map(int,input().split()))

ANS=1<<60

for i in range(1<<N):
    SET=set()
    
    for j in range(N):
        if i & (1<<j) !=0:
            SET.add(j)

    for renew in range(N):
        for j in range(N):
            if X[j] <= SET:
                SET.add(j)

    if len(SET)==N:
        ANS=min(ANS,sum([A[j] for j in range(N) if i & (1<<j) !=0]))
        
print(ANS)
0