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 <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int n){
int cor[n];
fill(cor,cor+n,-1);
int pos[n];
fill(pos,pos+n,-1);
int S[n];
int kolor,odp,l,p,md,cur=0;
for (int i = 0; i<n; i++){
for (int j = 0; j<n; j++){
if (cor[j]>=0)S[j]=cor[j];
else S[j]=0;
}
odp=tryCombination(S);
if (odp==-1 || odp>i)kolor=0;
else kolor=1;
l=0,p=n-i;
while(l<p){
md=(l+p)/2;
cur=0;
for (int j = 0; j<n; j++){
if (cor[j]>=0)S[j]=cor[j];
else if (cur++<md)S[j]=kolor;
else S[j]=kolor^1;
}
odp=tryCombination(S);
if (odp==-1 || odp>i)p=md;
else l=md+1;
}
cor[l]=kolor;
pos[l]=i;
}
answer(cor,pos);
}
# | 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... |