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 ll long long
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vll vector<pll>
#define vii vector<pii>
using namespace std;
void exploreCave(int n){
int arr[n], door[n];
memset(arr, 0, sizeof(arr));
memset(door,-1,sizeof(door));
bool vis[n];
memset(vis,false,sizeof(vis));
while(true){
int pos = tryCombination(arr);
if(vis[pos])
{
int random = rand() % n;
arr[random] = 1 - arr[random];
int pl = tryCombination(arr);
if(pl == -1)
break;
if(pl <= pos)
arr[random] = 1 - arr[random];
else{
door[random] = pos;
vis[pl] = true;
}
}
if(pos == -1){
break;
}
arr[pos] = 1 - arr[pos];
vis[pos] = true;
}
for(int i = 0; i < n; i++){
if(door[i] != -1)
continue;
arr[i] = 1 - arr[i];
int pos = tryCombination(arr);
//for(int j = 0; j < n;j++)
// cout<<arr[j]<<" ";
//cout<<pos<<endl;
door[i] = pos;
arr[i] = 1 - arr[i];
}
answer(arr, door);
}
# | 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... |