#include "bulb.h"
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> L, R;
int f(int x, int c) {
if (c == 0) {
if (x < 0) return 0;
if (f(R[x], 1)) return 1;
return f(L[x], c);
}
if (c == 1) {
if (x < 0) return x == -1;
if (f(R[x], 2) == 0) return 0;
return f(L[x], 1);
}
if (c == 2) {
if (x < 0) return x == -1;
return f(L[x], 2);
}
}
int FindWinner(int T, std::vector<int> LL, std::vector<int> RR){
L = LL, R = RR;
N = L.size();
int x = 0;
while (x >= 0) x = L[x];
if (x == -2) return 0;
return f(0, 0);
}
Compilation message
bulb.cpp: In function 'int f(int, int)':
bulb.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
352 KB |
Output is correct |
2 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |