Submission #108628

#TimeUsernameProblemLanguageResultExecution timeMemory
108628someone_aaLibrary (JOI18_library)C++17
19 / 100
3093 ms472 KiB
#include <cstdio> #include <vector> #include "library.h" #include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; const int maxn = 1100; vector<int>adj[maxn]; void Solve(int N) { vector<int> M(N); for(int i=0;i<N;i++) { M[i] = 0; } if(N == 1) { vector<int>v; v.pb(1); Answer(v); return; } for(int i=1;i<=N;i++) { for(int j=i+1;j<=N;j++) { M[i-1] = M[j-1] = 1; int x = Query(M); if(x == 1) { adj[i].pb(j); adj[j].pb(i); } M[i-1] = M[j-1] = 0; } } int st = 1; for(int i=1;i<=N;i++) { if(adj[i].size() == 1) { st = i; break; } } vector<int>v; v.pb(st); st = adj[st][0]; for(int i=0;i<N-1;i++) { if(adj[st][0] == v.back()) { v.pb(st); st = adj[st][1]; } else { v.pb(st); st = adj[st][0]; } } Answer(v); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...