/***Farhan132***/
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
typedef int ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<ll> vll;
typedef pair<ll , ll> ii;
typedef vector< ii > vii;
typedef pair < pair < ll , ll > , pair < ll , ll > > cm;
#define ff first
#define ss second
#define pb push_back
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)
#define clean fflush(stdout)
const ll mod = (ll)1e9 + 7;
const ll maxn = (ll)2e5 + 5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e9;
ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};
int Query(const vector<int>& M)
{
return 1;
}
void Answer(const vector<int>& res)
{
for(auto u : res) cout << u << ' ';
cout << '\n';
}
void Solve(int n){
vector < ll > RES;
if(n == 1){
RES.pb(1);
Answer(RES);
return;
}
set < ll > s;
for(ll i = 1; i <= n; i++){
s.in(i);
}
ll ans[n+5];
for(ll i = 1; i <= n; i++){
s.erase(i);
vector < ll > q(n);
for(ll j = 1; j <= n; j++){
q.pb(((bool)(s.count(j))));
}
if(Query(q) == 1){
ans[1] = i;
break;
}
}
set < ll > final = s;
for(ll i = 2; i <= n; i++){
s = final;
while(s.size() > 1){
ll kk = s.size();
set < ll > save = s;
ll mid = (s.size()/2);
vector < ll > q(n, 0);
ll cnt = 0;
for(ll j = 0; j < mid; j++){
ll now = *s.begin();
q[now-1] = 1;
s.erase(now);
}
ll x = Query(q);
q[ans[i-1]-1] = 1;
ll y = Query(q);
if(x == y){
set < ll > f;
for(auto u : save){
if(!s.count(u)) f.in(u) ;
}
s = f;
cnt = 1;
}
}
ans[i] = *s.begin();
final.erase(ans[i]);
}
vector < ll > res;
for(ll i = 1; i <= n; i++) res.pb(ans[i]);
Answer(res);
return;
}
#ifdef LOCAL
int main() {
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#else
// freopen("cbarn2.in", "r", stdin);
// freopen("cbarn2.out", "w", stdout);
//ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#endif
//cout << fixed << setprecision(10);
// work();
// mem(b,0);
ll T;
T=1;
//cin >> T;
//scanf("%lld",&T);
// ll CT = 0;
//work();
while(T--){
//cout << "Case " << ++CT <<": " ;
//printf("Case %lld: ",++CT);
Solve(T+5);
}
return 0;
}
#endif
Compilation message
library.cpp: In function 'void Solve(int)':
library.cpp:90:10: warning: unused variable 'kk' [-Wunused-variable]
90 | ll kk = s.size();
| ^~
library.cpp:94:10: warning: variable 'cnt' set but not used [-Wunused-but-set-variable]
94 | ll cnt = 0;
| ^~~
/tmp/ccTLnQvw.o: In function `Query(std::vector<int, std::allocator<int> > const&)':
library.cpp:(.text+0x0): multiple definition of `Query(std::vector<int, std::allocator<int> > const&)'
/tmp/cccYSsFC.o:grader.cpp:(.text+0x0): first defined here
/tmp/ccTLnQvw.o: In function `Answer(std::vector<int, std::allocator<int> > const&)':
library.cpp:(.text+0x10): multiple definition of `Answer(std::vector<int, std::allocator<int> > const&)'
/tmp/cccYSsFC.o:grader.cpp:(.text+0x390): first defined here
collect2: error: ld returned 1 exit status