#include <iostream>
#include "bulb.h"
using namespace std;
pair<int, int> G[300003];
int nr;
void dfs(int nod, int turns) {
if(nod == -1) return;
if(nod == -2) nr++;
else {
if(turns == 2) return;
else if(turns == 1)
dfs(G[nod].first, turns);
else {
dfs(G[nod].first, turns);
dfs(G[nod].second, turns + 1);
}
}
}
int FindWinner(int T, std::vector<int> L, std::vector<int> R){
int N = L.size();
int i;
for(i = 0; L[i] != -1 && L[i] != -2; i = L[i]);
if(L[i] == -2)
return 1;
else {
for(int i = 0; i < N; i++) {
G[i] = {L[i], R[i]};
}
dfs(0, 0);
if(nr > 1) return 0;
else return 1;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |