#include using namespace std; #ifdef LOCAL #include "debug.hpp" #else #define debug(...) 1 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); auto Ask = [&] (int x) { cout << "? " << x << endl; int ret; cin >> ret; return ret; }; int y1 = Ask(100); vector> can; for (int a = 0; a < 100; a++) { for (int b = a + 1; b <= 100; b++) { if ((a + 100) % b == y1) { can.push_back(make_pair(a, b)); } } } for (int i = 1; i <= 100; i++) { vector z; for (auto [u, v] : can) { z.push_back((u + i) % v); } if (can.size() == z.size()) { int y2 = Ask(i); for (auto [u, v] : can) { if (y2 == (u + i) % v) { cout << "! " << u << ' ' << v << endl; return 0; } } } } }