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 "cave.h"
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
typedef int64_t lld;
typedef pair<int, int> pii;
vector<int> v;
int query[5000] = {}, ans[5000] = {}, pos[5000] = {};
void exploreCave(int N){
v.resize(N);
fill(all(v), 1);
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++)
query[j] = ans[j] || v[j];
bool correct = (tryCombination(query) != i);
int l = 0, r = N+1;
while(r-l > 1){
for(int j = 0; j < N; j++)
query[j] = ans[j] || (v[j] && (j < (l+r)/2?correct:!correct));
if(tryCombination(query) == i)l = (l+r)/2;
else r = (l+r)/2;
}
v[l] = 0;
ans[i] = correct;
pos[l] = i;
}
answer(ans, pos);
}
# | 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... |