#include #include using namespace std; using namespace atcoder; #define ll long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define repl(i,a,b) for(ll i=(a);i<(b);i++) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() template bool chmin(T &a,T b){if(a>b){a=b;return true;} return false;} template bool chmax(T &a,T b){if(a> n; int l=-1,lx=-1; int r=-1,rx=-1; vector ans(n,-1); int now=n-2; bool can=true; while(1){ cout << "? " << now << " " << n-1 << endl; int x; cin >> x; if(x == 0){ ans[now]=0; now--; } else{ if(l == -1){ l=now; lx=x; now--; } else if(r == -1){ r=now; rx=x; cout << "? " << r << " " << l << endl; int y; cin >> y; ans[n-1]=sqrt(lx*rx/y); ans[l]=lx/ans[n-1]; ans[r]=rx/ans[n-1]; now--; } else{ ans[now]=x/ans[n-1]; now--; } } if(now == -1){ if(ans[n-1] == -1){ if(l != -1){ cout << "? " << l << " " << n-1 << endl; int x; cin >> x; bool can=false; rep(i,1,10)rep(j,1,10){ if(i*j == x){ if(i != j){ cout << "! " << -1 << endl; return; } ans[l]=ans[n-1]=i; can=true; } } if(can){ cout << "! "; for(int i=n-1;i>=0;i--){ cout << ans[i]; } cout << endl; } else cout << "! " << -1 << endl; } else cout << "! -1" << endl; } else{ cout << "! "; for(int i=n-1;i>=0;i--){ cout << ans[i]; } cout << endl; } return; } } return; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T=1; // cin >> T; while(T--) solve(); }