Submission #139469

#TimeUsernameProblemLanguageResultExecution timeMemory
139469zoooma13Library (JOI18_library)C++14
19 / 100
343 ms504 KiB
#include "bits/stdc++.h" #include "library.h" using namespace std; #define MAX_N 202 void Solve(int N) { assert(N < MAX_N); if(N == 1){ Answer({1}); return; } vector <int> M(N); vector <vector<int>> adj(N); for(int i=0; i<N; i++){ M[i] = 1; for(int j=i+1; j<N; j++){ M[j] = 1; if(Query(M) == 1) adj[i].push_back(j), adj[j].push_back(i); M[j] = 0; } M[i] = 0; } int st; for(int i=0; i<N; i++) if(adj[i].size() == 1) st = i; vector <int> res; for(int i=0; i<N; i++){ res.push_back(st+1); int to = adj[st].front(); adj[to].erase(find(adj[to].begin() ,adj[to].end() ,st)); st = to; } Answer(res); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...