Submission #266667

#TimeUsernameProblemLanguageResultExecution timeMemory
266667Toirov_SadiLibrary (JOI18_library)C++17
19 / 100
369 ms384 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...