#include #include #include #include int main() { std::set num; std::vector count(10); int x, y; std::cout << "0 1 2 3" << std::endl; std::cin >> x >> y; if (x == 4) return 0; for (int i = 0; i<4; ++i) { count[i] = x + y; } for (int p = 0; p <= 3; ++p) { for (int i = 4; i <= 9; ++i) { switch (p) { case 0: std::cout << "1 2 3 "; break; case 1: std::cout << "0 2 3 "; break; case 2: std::cout << "0 1 3 "; break; case 3: std::cout << "0 1 2 "; break; } std::cout << i << std::endl; std::cin >> x >> y; if (x == 4) return 0; count[i] = x + y; if (count[p] < count[i]) { num.insert(i); } else if (count[p] > count[i]) { num.insert(p); } if (num.size() == 4) break; } if (num.size() == 4) break; } std::vector cand(4); auto it = num.begin(); for (int i = 0; i<4; ++i, ++it) { cand[i] = *it; } do { for (int i = 0; i<4; ++i) { std::cout << cand[i] << " "; } std::cout << std::endl; std::cin >> x >> y; if (x == 4) return 0; } while (std::next_permutation(cand.begin(), cand.end())); return 0; }