#include #define rep(i, n) for (lli i = 0; i < (n); i++) #define rrep(i, n) for (lli i = (n)-1; i >= 0; i--) using namespace std; using lli = long long int; //#define DEBUG // 質問クエリ int ax = 34, ay = 45, az = -40; int solve(); void test() { solve(); } int ask(int x, int y, int z) { int d; #ifdef DEBUG return abs(x - ax) * 1000 + abs(y - ay) * 10 + abs(z - az); #endif cout << "?" << " " << x << " " << y << " " << z << endl; cin >> d; return d; } // 回答クエリ void answer(int x, int y, int z) { #ifdef DEBUG bool f = (x == ax and y == ay and z == az); if (!f) { cout << "NG" << ax << ":" << x << " " << ay << ":" << y << " " << az << ":" << z << endl; ; } return; #endif cout << "!" << " " << x << " " << y << " " << z << endl; } int solve(void) { int x[3][2] = {{-100, 100}, {-100, 100}, {-100, 100}}; while (abs(x[0][1] - x[0][0]) > 2) { int h = ask((2 * x[0][0] + x[0][1]) / 3, x[1][0], x[2][0]); int g = ask((x[0][0] + 2 * x[0][1]) / 3, x[1][0], x[2][0]); if (h < g) { x[0][1] = (x[0][0] + 2 * x[0][1]) / 3; } else { x[0][0] = (x[0][0] * 2 + x[0][1]) / 3; } } while (abs(x[1][1] - x[1][0]) > 2) { //int sita = ask(x[1][0], x[1][0], x[2][0]); //int ue = ask(x[1][1], x[1][0], x[2][0]); int h = ask(x[0][0], (2 * x[1][0] + x[1][1]) / 3, x[2][0]); int g = ask(x[0][0], (x[1][0] + 2 * x[1][1]) / 3, x[2][0]); if (h < g) { x[1][1] = (x[1][0] + 2 * x[1][1]) / 3; } else { x[1][0] = (x[1][0] * 2 + x[1][1]) / 3; } } while (abs(x[2][1] - x[2][0]) > 2) { //int sita = ask(x[2][0], x[1][0], x[2][0]); //int ue = ask(x[2][1], x[1][0], x[2][0]); int h = ask(x[0][0], x[1][0], (2 * x[2][0] + x[2][1]) / 3); int g = ask(x[0][0], x[1][0], (x[2][0] + 2 * x[2][1]) / 3); if (h < g) { x[2][1] = (x[2][0] + 2 * x[2][1]) / 3; } else { x[2][0] = (x[2][0] * 2 + x[2][1]) / 3; } } vector>> ans; rep(i, 3) { rep(j, 3) { rep(k, 3) { ans.push_back(make_pair(ask(x[0][0] + i, x[1][0] + j, x[2][0] + k), vector{x[0][0] + i, x[1][0] + j, x[2][0] + k})); } } } sort(ans.begin(), ans.end()); auto h = ans[0].second; answer(h[0], h[1], h[2]); return 0; } int main() { test(); }