이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
int con[5000],test[5000],ans[5000]; // switch i connect to door con[i]
bool fix_switch[5000];
void exploreCave(int n) {
for (int i=0; i<n; ++i) { //find door x (0 to x-1 are open)
int k;
if (tryCombination(ans)==i) k=1;
else k=0;
int l=0, r=n-1;
while (r>l) {
int mid=(l+r)/2;
for (int j=0; j<n; ++j) {
if (fix_switch[j]) test[j]=ans[j];
else test[j]=k;
}
for (int j=l; j<=mid; ++j) if (!fix_switch[j]) test[j]=1-k;
if (tryCombination(test)==i) r=mid; //not change
else l=mid+1; //change
}
ans[r]=k;
fix_switch[r]=true;
con[r]=i;
}
answer(ans,con);
}
# | 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... |