#include "park.h"
#include <bits/stdc++.h>
using namespace std;
int parent[1405];
void Detect(int T, int N) {
int a[1405];
vector<int> known = {0};
vector<int> nodes;
for(int i = 1; i < N; i++) nodes.push_back(i);
while(!nodes.empty()) {
int node = nodes.back();
nodes.pop_back();
int l = 0, r = known.size() - 1;
int par = -1;
while(l <= r) {
int mid = (l + r) / 2;
for(int i = 0; i < N; i++) a[i] = 0;
for(int x : known) a[x] = 1;
a[node] = 1;
if(Ask(0, node, a)) {
par = known[mid];
r = mid - 1;
} else {
l = mid + 1;
}
}
if(par == -1) par = known.back();
parent[node] = par;
known.push_back(node);
}
for(int i = 1; i < N; i++)
Answer(min(i, parent[i]), max(i, parent[i]));
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |