#include #include #include #include #include using namespace std; int main() { int id, N, M; scanf("%d %d %d", &id, &N, &M); vector hand(N); map my_count; for (int i = 0; i < N; i++) { scanf("%d", &hand[i]); my_count[hand[i]]++; } map total_count; int next_ask = 1; char cmd[16]; while (scanf("%s", cmd) == 1) { if (strcmp(cmd, "END") == 0) { int q; scanf("%d", &q); break; } if (strcmp(cmd, "TURN") == 0) { if (next_ask <= M) { printf("ASK %d\n", next_ask++); fflush(stdout); } else { vector guess; for (int v = 1; v <= M; v++) { int t = total_count.count(v) ? total_count[v] : 0; int mine = my_count.count(v) ? my_count[v] : 0; int c_guess = (t - mine + 1) / 2; for (int j = 0; j < c_guess; j++) guess.push_back(v); } while ((int)guess.size() > N) guess.pop_back(); while ((int)guess.size() < N) guess.push_back(1); sort(guess.begin(), guess.end()); printf("GUESS"); for (int v : guess) printf(" %d", v); printf("\n"); fflush(stdout); } } else if (strcmp(cmd, "WAIT") == 0) { } else if (strcmp(cmd, "COUNT") == 0) { int x, k; scanf("%d %d", &x, &k); total_count[x] = k; } else if (strcmp(cmd, "GUESSED") == 0) { int gid, ok; scanf("%d %d", &gid, &ok); } } return 0; }