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 <bits/stdc++.h>
#include "library.h"
#define pb push_back
using namespace std;
int deg[1005];
vector <int> g[1005],res;
void dfs (int v,int p = -1) {
res.pb(v + 1);
for (auto to : g[v])
if (to != p)
dfs(to,v);
}
void Solve(int N)
{
vector<int> M(N);
int cur = 0;
for (int i = 0; i < N; i ++) {
for (int j = i + 1; j < N; j ++) {
M[i] = M[j] = 1;
int o = Query(M);
if (o == 1) {
g[i].pb(j);
g[j].pb(i);
deg[i] ++;
deg[j] ++;
}
M[i] = M[j] = 0;
}
}
for (int i = 0; i < N; i ++) {
if (deg[i] == 1) {
cur = i;
break;
}
}
dfs(cur);
Answer(res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |