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>
#define endl '\n'
using namespace std;
const int MAXN=5009;
int g_d[MAXN],i_odkljucava[MAXN]={0},probaj[MAXN],vrata_br[MAXN];
bool checked[MAXN]={0};
int n;
int N;
int S[MAXN],D[MAXN];
void kojeg_odkljucava(int br,int l,int d){
if(l==d){
i_odkljucava[l]=br;
g_d[l]=vrata_br[br];
checked[l]=true;
return;
}
int s=(l+d)/2;
for(int i=0; i<n; i++){
if(checked[i]){
probaj[i]=g_d[i];
continue;
}
probaj[i]=1-vrata_br[br];
}
for(int i=l; i<=s; i++){
if(checked[i]){
probaj[i]=g_d[i];
continue;
}
probaj[i]=vrata_br[br];
}
int ans=tryCombination(probaj);
if(ans==-1||ans>br)
kojeg_odkljucava(br,l,s);
else
kojeg_odkljucava(br,s+1,d);
}
void resavaj_za(int br){
for(int i=0; i<n; i++){
if(checked[i]){
probaj[i]=g_d[i];
continue;
}
probaj[i]=0;
}
int ans=tryCombination(probaj);
if(ans==-1||ans>br)
vrata_br[br]=0;
else
vrata_br[br]=1;
kojeg_odkljucava(br,0,n);
//cout << vrata_br[br] << endl;
}
void exploreCave(int N) {
n=N;
for(int i=0; i<n; i++){
resavaj_za(i);
}
answer(g_d,i_odkljucava);
}
# | 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... |