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 mid ((l+r)>>1)
using namespace std ;
int s[5002] , cur[5002] , d[5002] ;
void exploreCave ( int n ) {
for ( int i = 0 ; i < n ; i++ ) {
s[i] = -1 ;
}
for ( int i = 0 ; i < n ; i++ ) {
for ( int j = 0 ; j < n ; j++ ) {
cur[j] = max ( 0 , s[j] ) ;
}
bool o = ( tryCombination(cur) == i ) ;
int l = 0 , r = n ;
while ( r - l > 1 ) {
for ( int j = 0 ; j < n ; j++ ) {
if ( s[j] != -1 ) {
cur[j] = s[j] ;
}
else {
if ( j < mid ) {
cur[j] = 0 ;
}
else {
cur[j] = 1 ;
}
}
}
if ( tryCombination(cur) == i ) {
if ( o ) {
r = mid ;
}
else {
l = mid ;
}
}
else {
if ( o ) {
l = mid ;
}
else {
r = mid ;
}
}
}
s[l] = o ;
d[l] = i ;
}
answer(s,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... |