Note that in this problem in very short string 01, the length of not more than 12, can be used to convert the set of integer representation, then open a two-dimensional array, about the pre-existence of all the strings inside and Wu maximum possible value queries on it.
1
int arr[i][v];
Specifically, a first array dimension may be converted to save a given string to an integer value of 01 $ I $, Wu when the second value is exactly equal to the answer at V $ $, then each processing line to interrogation, Wu will be less than the maximum value you can add up all the answers.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
CF1017D namespace { class Program large column [explanations] CF1017D { public class Free Join { public static int [,] ARR; public static int [] CNT, wuVal; }
_count = x = 0; for(int i = 0; i < len; i++) if(inp[i] == '1') x |= (1 << i);
for(int i = 0; i <= maxWu; i++) _count += Global.arr[x, i]; Console.WriteLine(_count.ToString()); }
} } }
Code that is the case, this question time cards very tight, cause I use C # tone for a long time or time out. After progressive translated into C ++ code on the AC.