Submission #344134

#TimeUsernameProblemLanguageResultExecution timeMemory
344134milleniumEeeeLibrary (JOI18_library)C++17
0 / 100
350 ms512 KiB
#include <bits/stdc++.h> #include "library.h" //#include "grader.cpp" using namespace std; // Query(M) = мин кол-во чтобы вырезать нужные числа const int MAXN = 1005; vector <int> g[MAXN]; vector <int> res; int n; int ask(int a, int b) { vector <int> need(n, 0); need[a - 1] = 1; need[b - 1] = 1; int x = Query(need); return x; } void dfs(int v, int par, int ind) { res[ind] = v; for (int to : g[v]) { if (to != par) { dfs(to, v, ind + 1); } } } void Solve(int N) { n = N; vector <int> deg(n + 1, 0); res.resize(n); for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { if (ask(i, j) == 1) { g[i].push_back(j); g[j].push_back(i); deg[i]++, deg[j]++; } } } int root = -1; for (int i = 1; i <= n; i++) { if (deg[i] == 1) { root = i; break; } } dfs(root, -1, 0); if (res.size() != n) { while (1); } Answer(res); }

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:52:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |   if (res.size() != n) {
      |       ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...