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 <cstdio>
#include <vector>
#include "library.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int maxn = 1100;
vector<int>adj[maxn];
void Solve(int N) {
vector<int> M(N);
for(int i=0;i<N;i++) {
M[i] = 0;
}
if(N == 1) {
vector<int>v;
v.pb(1);
Answer(v);
return;
}
for(int i=1;i<=N;i++) {
for(int j=i+1;j<=N;j++) {
M[i-1] = M[j-1] = 1;
int x = Query(M);
if(x == 1) {
adj[i].pb(j);
adj[j].pb(i);
}
M[i-1] = M[j-1] = 0;
}
}
int st = 1;
for(int i=1;i<=N;i++) {
if(adj[i].size() == 1) {
st = i;
break;
}
}
vector<int>v;
v.pb(st);
st = adj[st][0];
for(int i=0;i<N-1;i++) {
if(adj[st][0] == v.back()) {
v.pb(st);
st = adj[st][1];
}
else {
v.pb(st);
st = adj[st][0];
}
}
Answer(v);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |