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;
void exploreCave(int N) {
int ans[N], D[N];
int vis[N] = {0};
for(int i=0;i<N;i++){
ans[i] = 0;
}
for(int i=0;i<N;i++){
int ans2[N];
for(int j=0;j<N;j++)ans2[j] = ans[j];
int sg =0 ;
int y = tryCombination(ans2);
if(y <= i && y != -1)sg = 1;
for(int j=0;j<N;j++)if(!vis[j])ans2[j] = 1 - sg;
int s = 0, e = N - 1;
while(s < e){
int m = (s + e)/2;
int ans3[N];
for(int j=0;j<N;j++)ans3[j] = ans2[j];
for(int j=s;j<=m;j++)if(!vis[j])ans3[j] = sg;
int x = tryCombination(ans3);
if(x > i || x == -1)e = m;
else s = m + 1;
}
vis[s] = true;
D[s] = i;
ans[s] = sg;
}
answer(ans, D);
}
# | 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... |