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;
const int MAXN=5010;
int A[MAXN];
int match[MAXN], mark[MAXN];
inline int ask(){ return tryCombination(A);}
void exploreCave(int n){
for (int i=0; i<n; i++) mark[i]=1;
for (int i=0; i<n; i++){
if (ask()!=i) for (int j=0; j<n; j++) A[j]^=mark[j];
// now tryCombination is i
int dwn=0, up=n;
while (up-dwn>1){
int mid=(dwn+up)>>1;
for (int j=0; j<mid; j++) A[j]^=mark[j];
if (ask()==i) dwn=mid;
else up=mid;
for (int j=0; j<mid; j++) A[j]^=mark[j];
}
match[dwn]=i;
mark[dwn]=0;
A[dwn]^=1;
}
answer(A, match);
}
# | 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... |