性质:a[i]+a[j]==a[i]&a[j] + a[i]|a[j];
所以先由前三个算出a[1],再由a[1]推出其他值
#include<bits/stdc++.h>
#define LL long long
#define N 301010
#define M 1000100
using namespace std;
int n,k,a[N];
int main(){
int x,y,z,t;
scanf("%d%d",&n,&k);
cout<<"and"<<" 1 2"<<endl;
fflush(stdout);
cin>>x;
cout<<"or"<<" 1 2"<<endl;
fflush(stdout);
cin>>t;
x+=t;
cout<<"and"<<" 2 3"<<endl;
fflush(stdout);
cin>>y;
cout<<"or"<<" 2 3"<<endl;
fflush(stdout);
cin>>t;
y+=t;
cout<<"and"<<" 1 3"<<endl;
fflush(stdout);
cin>>z;
cout<<"or"<<" 1 3"<<endl;
fflush(stdout);
cin>>t;
z+=t;
a[1]=(x-y+z)/2;
a[2]=x-a[1];
a[3]=z-a[1];
for(int i=4;i<=n;i++){
cout<<"and 1 "<<i<<endl;
fflush(stdout);
cin>>x;
cout<<"or 1 "<<i<<endl;
fflush(stdout);
cin>>t;
x+=t;
a[i]=x-a[1];
}
sort(a+1,a+n+1);
cout<<"finish "<<a[k];
return 0;
}