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"
//#include "/Users/iantsai/Downloads/Cave problem/grader.c"
using namespace std;
void exploreCave(int n){
int s[n], d[n], cur[n];
bool done[n];
memset(done, 0, sizeof(done));
memset(cur, 0, sizeof(cur));
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(!done[j]) cur[j] = 0;
}
int pos = tryCombination(cur);
if(pos == -1) pos = n;
bool flag = 1;
if(pos > i){
flag = 0;
}
for(int j=0;j<n;j++){
if(!done[j]) cur[j] = !flag;
}
int l = 0, r = n-1;
while(l < r){
int mm = l+r >> 1;
for(int j=l;j<=mm;j++){
if(!done[j]) cur[j] = flag;
}
pos = tryCombination(cur);
if(pos == -1) pos = n;
for(int j=l;j<=mm;j++){
if(!done[j]) cur[j] = !flag;
}
if(pos > i) {
r = mm;
}
else{
l = mm+1;
}
}
d[l] = i;
s[l] = flag;
cur[l] = flag;
done[l] = 1;
}
answer(s, d);
}
Compilation message (stderr)
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:25:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
25 | int mm = l+r >> 1;
| ~^~
# | 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... |