이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <vector>
using namespace std;
int n, depth;
int states[5000];
int conn[5000];
vector<int> active;
bool try_comb() {
return tryCombination(states) != depth;
}
void find(int l, int r, bool prev) {
if(l==r-1) {
if(!prev)
states[active[l]]^=1;
conn[active[l]]=depth;
active.erase(active.begin()+l);
depth++;
return;
}
int mid=(l+r)/2;
bool s1=prev;
for(int i=0;i<mid;i++)
states[active[i]]^=1;
bool s2=try_comb();
if(s1==s2)
find(mid, r, s2);
else
find(l, mid, s2);
}
void exploreCave(int N) {
n=N;
for(int i=0;i<n;i++)
active.push_back(i);
while(!active.empty()) {
find(0, active.size(), try_comb());
}
answer(states, conn);
}
# | 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... |