Submission #48109

#TimeUsernameProblemLanguageResultExecution timeMemory
48109jeffLibrary (JOI18_library)C++14
0 / 100
49 ms388 KiB
#include <bits/stdc++.h> #include "library.h" using namespace std; vector<vector<int> > adj; vector<int> M, res, nv; void Solve(int N) { int l, r, m, c, d, e, t = 0, z, i, j; for (i = 0; i < N; ++i) adj.push_back(nv), M.push_back(0), res.push_back(-1); for (i = 0; i < N; ++i) { ++t; if (!i) continue; for (j = 0; j < M.size(); ++j) M[j] = 0; for (j = 0; j < i + 1; ++j) M[j] = 1; for (c = Query(M); c < t; --t) { l = 0; r = i - 1; while (l < r) { m = (l + r) / 2; for (j = 0; j < M.size(); ++j) M[j] = 0; for (j = l; j < m + 1; ++j) M[j] = j != z; d = Query(M); M[i] = 1; e = Query(M); (e < d + 1 ? r : l) = m + (e > d); } z = (l + r) / 2; adj[i].push_back(z); adj[z].push_back(i); } z = -1; } for (i = 0; i < N; ++i) if (adj[i].size() <= 1) { for (j = 0, c = i, t = -1; j < N - 1; ++j) { res[j] = c; if (adj[c][0] != t) c = adj[t = c][0]; else c = adj[t = c][1]; } res[j] = c; break; } for (i = 0; i < N; ++i) ++res[i]; Answer(res); }

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:14:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (j = 0; j < M.size(); ++j) M[j] = 0;
                     ~~^~~~~~~~~~
library.cpp:21:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for (j = 0; j < M.size(); ++j) M[j] = 0;
                             ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...