# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
98184 | onjo0127 | Library (JOI18_library) | C++11 | 3062 ms | 632 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 <cstdio>
#include <vector>
#include "library.h"
using namespace std;
vector<int> adj[209];
void Solve(int N) {
vector<int> M(N, 0);
for(int i=0; i<N; i++) {
M[i] = 1;
for(int j=i+1; j<N; j++) {
M[j] = 1;
int x = Query(M);
if(x == 1) {
adj[i].push_back(j);
adj[j].push_back(i);
}
M[j] = 0;
}
M[i] = 0;
}
vector<int> ans;
int st, p;
for(int i=0; i<N; i++) if(adj[i].size() <= 1) st = p = i;
while(1) {
ans.push_back(st + 1);
for(auto& it: adj[st]) if(it != p) {
p = st;
st = it;
break;
}
if(ans.back() == st + 1) break;
}
Answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |