#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
#include <unordered_map>
#define endl '\n'
#define mid ((l+r)/2)
#define F first
#define S second
#define pb push_back
#define yes void (cout<<"YES"<<endl)
#define no void (cout<<"NO"<<endl)
#define ump unordered_map <ll,ll>
#define sp " "
#define vll vector<ll>
#define pll pair<ll,ll>
typedef long long ll;
using namespace std;
const ll inf=1e18+9;
const int N=2e5+9;
const ll M=1e9+7;
ll n,m;
ll publish(vll v){
for(auto u : v)
cout<<u<<sp;
cout<<endl;
ll ret;
cin>>ret;
return ret;
}
void answer(vll v){
for(auto u : v){
cout<<u<<sp;
}
cout<<endl;
}
void solve(ll n){
vll v;
for(ll i=1; i<=n ; i++){
v.pb(i);
}
ll ans=publish(v);
for(ll i=1 ; i<=n ; i++){
for(ll j=1 ; j<=n ; j++){
if(i==j) continue;
swap(v[i],v[j]);
ll x=publish(v);
if(x<ans){
ans=x;
break;
}
else
swap(v[i],v[j]);
}
if(ans==0)
break;
}
answer(v);
}
int main(){
int tt=1;
cin>>tt;
while(tt--){
cin>>n;
solve(n);
}
}
Compilation message
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
20 | if(v.size() != N) {
| ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | if(v.size() != N) {
| ~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccxugJ9M.o: in function `main':
interface.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccTJzyHN.o:art.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccxugJ9M.o: in function `main':
interface.cpp:(.text.startup+0x16): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status