結果
問題 | No.943 取り調べ |
ユーザー |
![]() |
提出日時 | 2019-12-05 22:17:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 169 ms / 1,206 ms |
コード長 | 325 bytes |
コンパイル時間 | 189 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 77,824 KB |
最終ジャッジ日時 | 2024-12-23 01:38:25 |
合計ジャッジ時間 | 3,007 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
n = int(input()) b = [ int(''.join(list(reversed(input().replace(" ", "")))), 2) for i in range(n) ] a = list(map(int, input().split())) dp = [1 << 28] * (1 << n) dp[0] = 0 for i in range(1 << n): for j in range(n): dp[i | 1 << j] = min(dp[i | 1 << j], dp[i] + (0 if (i & b[j]) == b[j] else a[j])) print(dp[-1])