이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |