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>
#include <fstream>
#define lcm(a,b) (a/__gcd(a,b))*b
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define F first
#define S second
//"\n"
using namespace std;
void exploreCave(int n){
int s[n];
int d[n];
int res[n];
vector<bool>vis(n+1,false);
for(int i=0;i<n;i++){
for(int l=0;l<n;l++){
if(vis[l])continue;
s[l]=0;
}
int x=tryCombination(s);
int c=1;
if(x>i or x==-1){
c=0;
}
int b=0,e=n-1;
int pos=0;
while(b<=e){
int mid=(b+e)/2;
for(int l=0;l<n;l++){
if(vis[l])continue;
s[l]=c;
if(l<b or l>mid)s[l]=!c;
}
x=tryCombination(s);
if(x>i or x==-1){
pos=b;
e=mid-1;
}else{
pos=mid+1;
b=mid+1;
}
}
vis[pos]=1;
s[pos]=c;
res[pos]=c;
d[pos]=i;
}
answer(res,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... |