#include #include using namespace std; const int SIZE = 15; const int NUMCOLORS = 20; const int MAX = 32768; // NUMCOLORS^SIZE must be <= this value const int MAXGUESS = 10; char *check = "DFEA"; // debugging purposes struct code { char vals[SIZE]; } codes[MAX], guesses[MAXGUESS]; int nCodes; // number of possible codes struct ans { int b, w; } answer[MAXGUESS]; int possible[MAX]; // index to possible answer codes int nPoss; void genCodes(int i, int size, int numColor, int code[]) // // generate and store all possible code for a given size and given number // of colors // { if (i == size) { for(int j=0; j max) { max = ans[j][k]; } } return max; } int main() { int i, j; int size, numColor, numGuess; int numCase; cin >> numCase; for(int iCase = 1; iCase <= numCase; iCase++) { cin >> size >> numColor >> numGuess; nCodes = 0; int *temp = new int[size]; genCodes(0, size, numColor, temp); for(i=0; i> guesses[i].vals[j]; cin >> answer[i].b >> answer[i].w; } determinePoss(guesses, answer, numGuess, size); int best = partition(codes[0], possible, nPoss, size); int c = 0; for(i=1; i