# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150534 | =SUM(D1:D9) (#200) | Bulb Game (FXCUP4_bulb) | C++17 | 89 ms | 8192 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"
std::vector<int> left,right;
std::pair<int,int> func(int k)
{
int pivot;
int C = 1;
for(pivot = k; pivot>=0; pivot = left[pivot])
{
int p = right[pivot];
while(p>=0) p = left[p];
if(p==-2) C = 0;
}
if(pivot==-2) return std::make_pair(0,C);
else return std::make_pair(1,C);
}
int FindWinner(int T, std::vector<int> L, std::vector<int> R){
int N = L.size();
left = L, right = R;
int pivot = 0;
while(pivot>=0) pivot = L[pivot];
if(pivot==-2) return 0;
pivot = 0;
while(pivot>=0)
{
std::pair<int,int> P = func(R[pivot]);
if(P.second==1) return 1;
if(P.first==1) pivot = L[pivot];
else return 0;
}
return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |