#include<bits/stdc++.h>
#include "library.h"
#define rep(a,b,c) for(ll a=b;a<=c;++a)
#define ll long long
#define ff first
#define ss second
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
using namespace std;
const ll N=1005,inf=1e18;
ll n,G[N][N],deg[N],head;
vector<int> T,ans;
bitset<N> flag;
ll nxt(ll u){
rep(v,1,n) if(!flag[v]&&G[u][v]) return v;
return 0;
}
void Solve(int NN){
n=NN;
T.resize(n);
rep(i,1,n) rep(j,i+1,n){
T[i-1]=T[j-1]=1;
if(Query(T)==1) G[i][j]=G[j][i]=1,deg[i]++,deg[j]++;
T[i-1]=T[j-1]=0;
}
rep(i,1,n) if(deg[i]==1) head=i;
ll u=head;
while(ans.size()<n){
ans.push_back(u);
flag[u]=1;
u=nxt(u);
}
Answer(ans);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |