이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |