Durgesh and string

4.1

19 votes
Easy-Medium
Problem

My dear friend Durgesh loves math very much. He likes to challenge himself with different maths puzzle. Unlike many of us he has maths problem coming in his dreams! One night he dreamed of the following problem. Given a set of binary strings and number of zeros and ones. Find out maximum number of strings that can created from the given set using given zeros and ones. You can only use one '0' or '1' once only. It is not necessary that you use all the zeros and ones given. As he is very lazy he has asked you to solve this problem for him.

Input:

First line contain N, number of strings in the set. N lines follows, each consist of string (of '0' and '1' ). Last line contain two integers denoting number of ones and zeros respectively.

Output:

One line containing the required output.

Constraint:

0 < N < 18

0 < Number of zeros <= 500

0 < Number of ones <= 500

Time Limit: 0
Memory Limit: 256
Source Limit:
Editor Image

?