Only the first inquiry the number, ask st, once abandoned are elements, before assuming rear element array is sorted For the former elements, and They are ,and so Appeared in a total times, Appeared in a total times. thus, readily available.
#include<bits/stdc++.h>
using namespace std;
int main(){
int times1=0,times2=0;
int n,k;
cin>>n>>k;
int pos1,pos2;
int num1,num2;
cout<<"?";
for(int i=2;i<=k+1;i++){
cout<<' '<<i;
}
cout<<endl;
cin>>pos1>>num1;
times1++;
fflush(stdout);
for(int i=2;i<=k+1;i++){
cout<<"?";
for(int j=1;j<=k+1;j++){
if(j!=i) cout<<" "<<j;
}
cout<<endl;
int tmp_pos,tmp_num;
cin>>tmp_pos>>tmp_num;
if(tmp_pos==pos1) times1++;
else {times2++;pos2=tmp_pos;num2=tmp_num;}
fflush(stdout);
}
if(num1>num2){
cout<<"! "<<times1<<'\n';
}else {
cout<<"! "<<times2<<'\n';
}
}