# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
798000 | vjudge1 | Library (JOI18_library) | C++17 | 222 ms | 412 KiB |
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;
void Solve(int N){
vector<int>v(N);
vector<int>tmp[N];
vector<bool>vis(N, 0);
for(int i = 0; i < N; i++){
if(i > 0) v[i - 1] = 0;
v[i] = 1;
v[N - 1] = 0;
for(int j = i + 1; j < N; j++){
if(j > i + 1) v[j - 1] = 0;
v[j] = 1;
if(Query(v) == 1){
tmp[i].push_back(j);
tmp[j].push_back(i);
}
}
}
int cur = -1;
for(int i = 0; i < N; i++){
if(tmp[i].size() == 1){
cur = i;
break;
}
}
vector<int>res;
while(res.size() < N){
res.push_back(cur + 1);
vis[cur] = true;
for(auto &x: tmp[cur]){
if(!vis[x]){
vis[x] = true;
cur = x;
break;
}
}
}
Answer(res);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |