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 foreach for
#define in :
using namespace std;
typedef long long ll;
const int MODULO = 1e9+7;
const ll INF = 1e18+1;
template<class X ,class Y>
bool Minimize(X &x , Y y)
{
if(x > y)
{
x = y ;
return true;
}
return false;
}
template<class X ,class Y>
bool Maximize(X &x , Y y )
{
if(x < y)
{
x = y;
return true;
}
return false;
}
template<class X ,class Y>
void Add(X &x , Y y)
{
x += y;
if( x >= MODULO) x -= MODULO;
}
template<class X ,class Y>
void Sub(X &x , Y y )
{
x -= y ;
if( x < 0 ) x += MODULO;
}
void exploreCave(int n)
{
int status[n] ;
int related[n];
for(int i = 0 ; i < n ; i++)
{
related[i] = 0;
status[i] = 0;
}
vector<int>List;
for(int i = 0 ; i < n ; i++)List.push_back(i);
for(int i = 0 ; i < n ; i++)
{
foreach(int v in List)status[v] = 0;
if(tryCombination(status) != i)foreach(int v in List)status[v] = 1;
int l = 0 ;
int r = (int)List.size()-1;
while(l <= r)
{
int mid = (l+r) >> 1;
for(int i = 0 ; i <= mid ; i++)
{
status[List[i]] ^= 1;
}
int x = tryCombination(status);
for(int i = 0 ; i <= mid ;i++)
{
status[List[i]] ^= 1;
}
if(x == i)l = mid+1;
else r = mid-1;
}
int pos = List[l];
swap(List[l] , List.back());
List.pop_back();
status[pos] ^=1;
related[pos] = i;
}
answer(status , related);
}
# | 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... |