# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100768 | JPN20 | Library (JOI18_library) | C++17 | 530 ms | 640 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |