{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"A bar-code symbol consists of alternating dark and light bars, starting with a dark bar on the left. Each bar is a number of units wide. Figure 1 shows a bar-code symbol consisting of 4 bars that extend over 1+2+3+1\u003d7 units. \r\u003cbr\u003e\u003ccenter\u003e\u003cimg src\u003d\"CDN_BASE_URL/c1139d413836e60a90bb99ea09ccf9eb?v\u003d1726074999\"\u003e\r\u003cbr\u003eFigure 1: Bar-code symbol over 7 units (see top) with 4 bars (see bottom)\u003c/center\u003e\r\u003cbr\u003e\r\u003cbr\u003eIn general, the bar code BC(n,k,m) is the set of all symbols with k bars that together extend over exactly n units, each bar being at most m units wide. For instance, the symbol in Figure 1 belongs to BC(7,4,3) but not to BC(7,4,2). \r\u003cbr\u003e\u003ccenter\u003e\u003cpre\u003e\r\u003cbr\u003e0: 1000100 | 8: 1100100\r\u003cbr\u003e1: 1000110 | 9: 1100110\r\u003cbr\u003e2: 1001000 | 10: 1101000\r\u003cbr\u003e3: 1001100 | 11: 1101100\r\u003cbr\u003e4: 1001110 | 12: 1101110\r\u003cbr\u003e5: 1011000 | 13: 1110010\r\u003cbr\u003e6: 1011100 | 14: 1110100\r\u003cbr\u003e7: 1100010 | 15: 1110110\r\u003cbr\u003eFigure 2: All symbols of BC(7,4,3)\u003c/pre\u003e\u003c/center\u003e\r\u003cbr\u003e\r\u003cbr\u003eFigure 2 shows all 16 symbols in BC(7,4,3). Each `1\u0027 represents a dark unit, each `0\u0027 a light unit. The symbols appear in lexicographic (dictionary) order. The number on the left of the colon (`:\u0027) is the rank of the symbol. The symbol in Figure 1 has rank 4 in BC(7,4,3). \r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Your program is to read from standard input. The first line contains the numbers n, k, and m (1 \u0026lt;\u003d n,k,m \u0026lt;\u003d 33). On the second line is a number s (0 \u0026lt;\u003d s \u0026lt;\u003d 100). The following s lines each contain some symbol in BC(n,k,m), represented by \u00270\u0027s and \u00271\u0027s as in Figure 2. "}},{"title":"Output","value":{"format":"HTML","content":"Your program is to write to standard output. On the first line your program should write the total number of symbols in BC(n,k,m). On each of the s following lines, it should write the rank of the corresponding symbol in the input."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e7 4 3\r\n5\r\n1001110\r\n1110110\r\n1001100\r\n1001110\r\n1000100\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e16\r\n4\r\n15\r\n3\r\n4\r\n0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}