Submission #154225

# Submission time Handle Problem Language Result Execution time Memory
154225 2019-09-19T11:41:18 Z salexandru Bulb Game (FXCUP4_bulb) C++17
0 / 100
3 ms 380 KB
#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 0;
  else {
    for(int i = 0; i < N; i++) {
      G[i] = {L[i], R[i]};
    }
    dfs(0, 0);
    if(nr > 1) return 1;
    else return 0;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 3 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -