# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48066 | 2018-05-10T02:10:22 Z | kawaiigrabrielneko | Library (JOI18_library) | C++14 | 0 ms | 0 KB |
#include <cstdio> #include <vector> //#include "library.h" using namespace std; vector<int> al[209]; void Solve(int N){ vector<int> M(N); for (int i = 0; i < N; i++){ for (int j = 0; j < i; j++){ M[i] = 1; M[j] = 1; if (Query(M)==1){ al[i].push_back(j); al[j].push_back(i); } M[i] = 0; M[j] = 0; } } int ed = 0; while (al[ed].size()==2) ed++; vector<int> ans(N); ans[0] = ed; if (N>1) ans[1] = al[ed][0]; for (int i = 2; i < N; i++){ if (al[ans[i-1]][0]==ans[i-2]) ans[i] = al[ans[i-1]][1]; else ans[i] = al[ans[i-1]][0]; } for (int i = 0; i < N; i++){ ans[i]++; } Answer(ans); }