Submission #98183

#TimeUsernameProblemLanguageResultExecution timeMemory
98183onjo0127Library (JOI18_library)C++11
0 / 100
3092 ms576 KiB
#include <cstdio> #include <vector> #include "library.h" using namespace std; vector<int> adj[209]; void Solve(int N) { vector<int> M(N, 0); for(int i=0; i<N; i++) { M[i] = 1; for(int j=i+1; j<N; j++) { M[j] = 1; int x = Query(M); if(x == 1) { adj[i].push_back(j); adj[j].push_back(i); } M[j] = 0; } M[i] = 0; } vector<int> ans; int st, p; for(int i=0; i<N; i++) if(adj[i].size() == 1) st = p = i; while(1) { ans.push_back(st + 1); for(auto& it: adj[st]) if(it != p) { p = st; st = it; break; } if(ans.back() == st + 1) break; } Answer(ans); }

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:28:32: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
         for(auto& it: adj[st]) if(it != p) {
                                ^~
library.cpp:27:26: warning: 'st' may be used uninitialized in this function [-Wmaybe-uninitialized]
         ans.push_back(st + 1);
                       ~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...