# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
206907 | vardan__02 | Cave (IOI13_cave) | C++14 | 0 ms | 0 KiB |
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
int s[5005],d[5005];
void get_d(int S[], int ss)
{
for(int i=0;i<ss;i++)
{
S[i]=(S[i]+1)%2;
int x=tryCombination(S);
d.PB(x);
S[i]=(S[i]+1)%2;
}
answer(S,d);
}
void exploreCave(int N)
{
int n = N, x = 0, y = 0;
for(int i=0;i<n;i++)
s.PB(0);
int i=0;
while(i<=n-2)
{
x=tryCombination(s);
if(x==-1)
{
get_d(s,n);
return;
}
s[i+1]=(s[i+1]+1)%2;
y=tryCombination(s);
if(y==-1)
{
get_d(s,n);
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);
return;
}