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 <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <set>
#include <map>
#include "cave.h"
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
void get_d(int S[], int ss)
{
int*d = new int[ss];
for(int i=0;i<ss;i++)
{
S[i]=(S[i]+1)%2;
int x=tryCombination(S);
d[i]=x;
S[i]=(S[i]+1)%2;
}
answer(S,d);
delete[]d;
}
void exploreCave(int N)
{
int n = N, x = 0, y = 0;
int i=0;
int*s = new int[n]{};
while(i<=n-2)
{
x=tryCombination(s);
if(x==-1)
{
get_d(s,n);
delete[]s;
return;
}
s[i+1]=(s[i+1]+1)%2;
y=tryCombination(s);
if(y==-1)
{
get_d(s,n);
delete[]s;
return;
}
if(x==y)
s[i]=(s[i]+1)%2;
i++;
}
x=tryCombination(s);
if(x!=-1)
s[n-1]=(s[n-1]+1)%2;
get_d(s,n);
delete[]s;
return;
}
# | 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... |