#line 1 "library/Template/template.hpp" #include using namespace std; #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() #define UNIQUE(v) sort(ALL(v)),(v).erase(unique(ALL(v)),(v).end()) #define MIN(v) *min_element(ALL(v)) #define MAX(v) *max_element(ALL(v)) #define LB(v,x) lower_bound(ALL(v),(x))-(v).begin() #define UB(v,x) upper_bound(ALL(v),(x))-(v).begin() using ll=long long int; using ull=unsigned long long; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; templateinline bool chmax(T& a,T b){if(ainline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} templateT ceil(T x,U y){assert(y!=0); if(y<0)x=-x,y=-y; return (x>0?(x+y-1)/y:x/y);} templateT floor(T x,U y){assert(y!=0); if(y<0)x=-x,y=-y; return (x>0?x/y:(x-y+1)/y);} templateint popcnt(T x){return __builtin_popcountll(x);} templateint topbit(T x){return (x==0?-1:63-__builtin_clzll(x));} templateint lowbit(T x){return (x==0?-1:__builtin_ctzll(x));} #line 2 "sol.cpp" int ask(vector& a){ cout<<"? "; rep(i,0,a.size())cout<>B; return B; } void answer(vector& a){ cout<<"! "; rep(i,0,a.size())cout<>n; vector L(n),R(n); iota(ALL(L),0); R=L; reverse(ALL(R)); auto convert=[&](vector& a)->vector{ vector cnt(n),ret(n); rep(i,0,n){ int sum=0; rep(j,0,a[i])sum+=cnt[j]; ret[n-i-1]=a[i]-sum; cnt[a[i]]++; } return ret; }; auto inverse=[&](vector& a)->vector{ vector ret(n),cnt(n); for(int i=n-1;i>=0;i--){ int sum=0; rep(j,0,n)if(cnt[j]==0){ sum++; if(sum==a[i]+1){ ret[n-1-i]=j; break; } } cnt[ret[n-1-i]]++; } return ret; }; for(;;){ auto nxt=L; next_permutation(ALL(nxt)); if(nxt==R)break; auto cL=convert(L); auto cR=convert(R); vector cmid(n),odd(n),add(n); for(int i=n-1;i>=0;i--){ cmid[i]=(cL[i]+cR[i])/2; odd[i]=(cL[i]+cR[i])&1; } for(int i=n-1;i>0;i--)if(odd[i]){ if(i&1){ if(i>1)add[i-2]+=i*(i-1)/2; } else{ add[i-1]+=i/2; } } int up=0; rep(i,0,n){ cmid[i]+=add[i]+up; up=0; if(cmid[i]>i){ up+=cmid[i]/(i+1); cmid[i]%=(i+1); } } assert(up==0); auto mid=inverse(cmid); if(ask(mid))L=mid; else R=mid; } if(ask(R))answer(R); else answer(L); return 0; }