Submission #119087

#TimeUsernameProblemLanguageResultExecution timeMemory
119087spacewalkerLibrary (JOI18_library)C++14
0 / 100
3080 ms432 KiB
#include <cstdio> #include <vector> #include "library.h" using namespace std; void Solve(int N) { int start = -1; vector<int> toQuery(N, 1); for (int i = 0; i < N; ++i) { toQuery[i] = 0; if (Query(toQuery) == 1) { start = i; break; } toQuery[i] = 1; } vector<int> ans{start}; // printf("start %d\n", start); for (int i = 1; i < N; ++i) { for (int pnext = 0; pnext < N; ++pnext) { if (ans.size() > 1 && pnext == *next(ans.rbegin(), 1)) continue; if (pnext == ans.back()) continue; vector<int> toQuery(N); toQuery[ans.back()] = toQuery[pnext] = 1; if (Query(toQuery) == 1) { ans.push_back(pnext); // printf("next %d\n", pnext); break; } } } vector<int> retVal; for (int x : ans) retVal.push_back(x + 1); Answer(retVal); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...