# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
148654 | | Cafe Maru (#200) | Bulb Game (FXCUP4_bulb) | C++17 | | 13 ms | 376 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"
const int RED = -1;
const int BLUE = -2;
using vi = std::vector<int>;
int GetBulb(const vi& L, const vi& R, const vi& S){
int cur = 0;
while(1){
if(S[cur]==0){
if(L[cur]<0) return L[cur];
cur = L[cur];
}
else if(S[cur]==1){
if(R[cur]<0) return R[cur];
cur = R[cur];
}
}
}
int FindWinner(int T, std::vector<int> L, std::vector<int> R){
const int N = L.size();
vi S(N);
for(int i=0;i<N;i++){
S[i] = 1-S[i];
bool all_red = true;
for(int j=0;j<N;j++){
S[j] = 1-S[j];
int res = GetBulb(L, R, S);
if(res==BLUE) all_red = false;
}
if(all_red) return 1;
}
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... |