Submission #130202

#TimeUsernameProblemLanguageResultExecution timeMemory
130202RockyBLibrary (JOI18_library)C++17
19 / 100
3099 ms2876 KiB
#include "library.h" #include <bits/stdc++.h> using namespace std; const int MAXN = (int)1e5 + 7; vector <int> g[MAXN]; void Solve(int N) { vector <int> A(N); for (int i = 1; i <= N; i++) { for (int j = i + 1; j <= N; j++) { A[i - 1] = A[j - 1] = 1; int cnt = Query(A); if (cnt == 1) { g[i].push_back(j); g[j].push_back(i); } A[i - 1] = A[j - 1] = 0; } } int v = -1, p = -1; vector <int> ans; for (int i = 1; i <= N; i++) { // cerr << i << " -> " << g[i].size() << endl; if (g[i].size() <= 1) { v = i; break; } } while (ans.size() < N) { ans.push_back(v); for (auto it : g[v]) { if (it != p) { p = v; v = it; break; } } } // for (auto it : ans) cerr << it << ' '; Answer(ans); }

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (ans.size() < N) {
         ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...