This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
#include "library.h"
using namespace std;
#define MAX_N 202
void Solve(int N)
{
assert(N < MAX_N);
if(N == 1){
Answer({1});
return;
}
vector <int> M(N);
vector <vector<int>> adj(N);
for(int i=0; i<N; i++){
M[i] = 1;
for(int j=i+1; j<N; j++){
M[j] = 1;
if(Query(M) == 1)
adj[i].push_back(j),
adj[j].push_back(i);
M[j] = 0;
}
M[i] = 0;
}
int st;
for(int i=0; i<N; i++)
if(adj[i].size() == 1)
st = i;
vector <int> res;
for(int i=0; i<N; i++){
res.push_back(st+1);
int to = adj[st].front();
adj[to].erase(find(adj[to].begin() ,adj[to].end() ,st));
st = to;
}
Answer(res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |