# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
149914 | | Little Piplup (#200) | Bulb Game (FXCUP4_bulb) | C++17 | | 1080 ms | 7440 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 "bulb.h"
int n;
std::vector <int> Left, Right;
int check_which_bulb(std::vector <bool> &bt)
{
int ans = 0;
while(ans >= 0)
{
if (bt[ans])
ans = Right[ans];
else ans = Left[ans];
}
return ans;
}
bool redhub(std::vector <bool> bt)
{
for (int i = 0; i<n; i++)
{
if (bt[i])
continue;
else
{
bt[i] = true;
int u = check_which_bulb(bt);
if (u == -2)
return false;
bt[i] = false;
}
}
return true;
}
int FindWinner(int T, std::vector<int> L, std::vector<int> R)
{
Left = L, Right = R;
int N = L.size();
n = N;
std::vector <bool> on (N, false);
int start = check_which_bulb(on);
//printf("%d\n", start);
if (start == -2)
return 0;
for (int i = 0; i<N; i++)
{
on[i] = true;
if (redhub(on))
{
//printf("Redhub found %d\n",i);
return 1;
}
on[i] = false;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |