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 <iostream>
#include "cave.h"
using namespace std;
/*
void answer(int S[], int D[]){
for(int i = 1 ; i )
}
int tryCombination(int S[]) {
int i;
++num_calls;
for (i = 0; i < N; ++i)
if (S[inv[i]] != realS[inv[i]])
return i;
return -1;
}
*/
void exploreCave(int n) {
int door[n] = {0}, per[n] = {0}, seen[n] = {0};
for(int i = 0; i < n; i++){
int from = 0, to = n - 1;
if(i <= tryCombination(door))
for(int j = 0; j < n; j++)
if(seen[j] == 0)
door[j] ^= 1;
while(from < to){
int mid = (from + to) / 2;
for(int j = 0; j < mid; j++)
if(seen[j] == 0)
door[j] ^= 1;
int val = tryCombination(door);
if(i <= val || val == -1){
to = mid;
} else
from = mid + 1;
for(int j = 0; j < mid; j++)
if(seen[j] == 0)
door[j] ^= 1;
}
door[from] ^= 1;
per[from] = i;
seen[from] = 1;
}
answer(door, per);
}
# | 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... |