#include "park.h"
#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define pb push_back
int p[1502] = {};
void Detect(int T, int N){
int t = T, n = N;
int mez[n + 1] = {1};
vector<int> v[10] = {};
v[0].pb(0);
for (int k = 1; k <= 8; k++){
for (int i = 1; i < n; i++){ // graphs vpoulobt simagleebis mixedvit
if (mez[i]){
continue;
}
mez[i] = 1;
if (Ask(0, i, mez)){
v[k].pb(i);
}
mez[i] = 0;
}
for (auto h : v[k]){
mez[h] = 1;
}
}
for (auto h : v[1]){
cout << h << " " << 0 << endl;
Answer(0, h);
p[h] = 0;
}
for (int k = 2; k <= 8; k++){
for (auto h : v[k]){
int l = 0, r = v[k - 1].size() - 1, ans = r;
while (l <= r){
int mid = (l + r) / 2;
int a[n] = {};
a[h] = 1;
a[0] = 1;
for (int i = l; i <= mid; i++){ // FILL
int x = v[k - 1][i];
while (x != 0){
a[x] = 1;
x = p[x];
}
}
int s = Ask(0, h, a);
if (s){
r = mid - 1;
ans = mid;
}else{
l = mid + 1;
}
}
p[h] = v[k - 1][ans];
cout << h << " " << v[k - 1][ans] << endl;
Answer(min(h, v[k - 1][ans]), max(h, v[k - 1][ans]));
}
}
}
| # | 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... |