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;
typedef pair<int,int> ii;
const int LOG = 13;
void exploreCave(int N) {
int ges[LOG][N];
int los[N];
int fig[N];
int rep[N],ros[N];
memset(fig,0,sizeof(fig));
memset(los,0,sizeof(los));
for(int i=0;i<LOG;i++) {
for(int j=0;j<N;j++) {
ges[i][j] = ((j&(1<<i))?1:0);
}
}
for(int i=0;i<N;i++) {
int idx = 0;
ii reb = {-1,-1};
for(int j=0;j<LOG;j++) {
int num = tryCombination(ges[j]);
if(num > i || num == -1) {
idx |= (1<<j);
}
}
int comp = ((1<<LOG)-1-idx);
if(comp >= N || fig[comp]) {
reb = {idx,1};
} else if(idx >= N || fig[idx]) {
reb = {comp,0};
} else {
los[idx] = los[comp] = 1;
int num = tryCombination(los);
if(num > i || num == -1) {
reb = {idx,1};
} else {
reb = {comp,0};
}
}
los[reb.first] = reb.second;
rep[reb.first] = i;
ros[reb.first] = reb.second;
fig[reb.first] = 1;
for(int j=0;j<LOG;j++) {
ges[j][reb.first] = reb.second;
}
}
answer(ros,rep);
}
# | 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... |