Logo
(追記) (追記ここまで)

13946번 - Bipartite Blanket 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB76535068.493%

문제

In a bipartite graph, nodes are partitioned into two disjoint sets A and B such that every edge connects a node from A with a node from B. A matching M is a set of edges where no two edges share a common node. We say that a matching M blankets a set of nodes V if every node in V is an endpoint of at least one edge in M.

We are given a bipartite graph where each node is assigned a weight — a positive integer. Weight of a set of nodes is simply the sum of the weights of the individual nodes.

Given an integer threshold t, find the number of different sets of nodes V such that the weight of V is at least t and V is blanketed by at least one matching M.

입력

The first line contains two integers n and m (1 ≤ n, m ≤ 20) — the number of nodes in A and B respectively. Let us denote the nodes of A with a1, a2, . . . , an and the nodes of B with b1, b2, . . . , bm.

The following n lines contain m characters each that describe the edges of the graph. The j-th character in the i-th line is “1” if there is an edge between ai and bj and “0” otherwise.

The following line contains n integers v1, v2, . . . , vn (1 ≤ vk ≤ 10 000 000) — the weights of the nodes a1, a2, . . . an. The following line contains m integers w1, w2, . . . , wm (1 ≤ wk ≤ 10 000 000) — the weights of the nodes b1, b2, . . . bm.

The following line contains an integer t (1 ≤ t ≤ 400 000 000) — the weight threshold.

출력

Output the number of sets of nodes whose weight is at least t and are blanketed by at least one matching M.

제한

예제 입력 1

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

예제 출력 1

3

예제 입력 2

3 2
01
11
10
1 2 3
4 5
8

예제 출력 2

13

힌트

In the first example above, subset {a1, a2, b2, b3} is blanketed by matching {(a1, b2),(a2, b3)} and has weight 21. Subsets {a3, b2, b3} and {a2, a3, b2, b3} are both blanketed by matching {(a2, b3),(a3, b2)}, and have weights 21 and 23 respectively. All the other subsets either weigh less than 21 or are not blanketed by any matching. For example, subset {a2, a3, b1, b3} has weight 26, but is not blanketed by any matching, so it’s not included in the count.

출처

ICPC > Regionals > Europe > Central European Regional Contest > CERC 2016 B번

Contest > Open Cup > 2016/2017 Season > Stage 8: Grand Prix of Europe B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /