#P3679. [CERC2016] 二分毯 Bipartite Blanket

[CERC2016] 二分毯 Bipartite Blanket

Description

In a bipartite graph, all vertices are split into two disjoint sets AA and BB, and every edge connects some vertex in AA to some vertex in BB. A matching is a set of edges such that no two edges share an endpoint. We say a matching MM covers a vertex set VV if and only if every vertex in VV is an endpoint of at least one edge in MM.

Given a bipartite graph where each vertex has a positive integer weight, define the weight of a vertex set as the sum of the weights of its vertices.

Given a parameter tt, count how many vertex sets VV satisfy that the weight of VV is at least tt, and VV is covered by at least one matching MM.

Input Format

The first line contains two positive integers n,mn, m, denoting the number of vertices in set AA and set BB, respectively.

The next nn lines each contain mm binary characters '0' or '1'. In the ii-th row and the jj-th column, a 11 indicates there is an edge between AiA_i and BjB_j.

The next line contains nn positive integers v1,v2,,vnv_1, v_2, \cdots, v_n, denoting the weight of each vertex in AA.

The next line contains mm positive integers w1,w2,,wmw_1, w_2, \cdots, w_m, denoting the weight of each vertex in BB.

The last line contains a positive integer tt, representing the parameter tt.

Output Format

Output a single integer on one line, the number of vertex sets that satisfy the condition.

3 3
010
111
010
1 2 3
8 5 13
21

3

3 2
01
11
10
1 2 3
4 5
8

13

Hint

1n,m201 \leq n, m \leq 20, 1vi,wi1071 \leq v_i, w_i \leq 10^7, 1t4×1081 \leq t \leq 4 \times 10^8.

Translated by ChatGPT 5