이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N){
vector<int> res;
res = {1};
set<int> p;
for(int i = 2; i <= N; i ++) p.insert(i);
vector<int> q(N, 0);
auto fll = [&](vector<int> &t){
int good = 1;
while(good == 1){
int last = res.back();
int nxt = -1;
good = 0;
for(auto x: p){
if(good == 1) break;
q[last - 1] = 1;
q[x - 1] = 1;
if(Query(q) == 1){
nxt = x;
good = 1;
}
q[last - 1] = 0;
q[x - 1] = 0;
}
if(good == 1){
p.erase(nxt);
res.push_back(nxt);
}
}
};
fll(res);
reverse(res.begin(), res.end());
fll(res);
Answer(res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |