이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |