Submission #100768

#TimeUsernameProblemLanguageResultExecution timeMemory
100768JPN20Library (JOI18_library)C++17
0 / 100
530 ms640 KiB
#include <bits/stdc++.h> #include "library.h" using namespace std; int c = 0, N; bool used[1009]; int getans(int pos) { vector<int>vec; for (int i = 0; i < N; i++) { if (used[i] == false) vec.push_back(i); } int sz = 1, cc = 0; while (sz <= vec.size()) { sz *= 2; cc++; } int cx = 0; for (int i = cc - 1; i >= 0; i--) { vector<int>V1(N, 0); for (int j = 0; j < cx + (1 << i); j++) { if (j >= vec.size()) break; V1[vec[j]] = 1; } vector<int>V2 = V1; V2[c] = 1; int F1 = Query(V1); int F2 = Query(V2); if (F1 != F2) cx += (1 << i); } return vec[cx]; } void Solve(int NN) { N = NN; for (int i = 0; i < N; i++) { vector<int>G(N, 1); G[i] = 0; int Z = Query(G); if (Z == 1) { c = i; } } vector<int>W; used[c] = true; W.push_back(c + 1); for (int i = 0; i < N - 1; i++) { int f = getans(c); W.push_back(f + 1); used[f] = true; c = f; } Answer(W); }

Compilation message (stderr)

library.cpp: In function 'int getans(int)':
library.cpp:13:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  int sz = 1, cc = 0; while (sz <= vec.size()) { sz *= 2; cc++; }
                             ~~~^~~~~~~~~~~~~
library.cpp:19:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (j >= vec.size()) break;
        ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...