Submission #982707

# Submission time Handle Problem Language Result Execution time Memory
982707 2024-05-14T16:25:53 Z vjudge1 Game (APIO22_game) C++17
0 / 100
0 ms 344 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

struct Nodo
{
  vector <int> ady;
  bool special = false;

};

vector <Nodo> g;

int dfs(int node, int target, bool isSpecial)
{
  //cout<<"call "<<node<<" "<<target<<endl;
  if (node == target )
  {
    if (isSpecial)
    {
      return 1;
    }

    return 0;
    
  }

  if (g[node].special)
  {
    isSpecial = true;
  }
  

  for (auto i : g[node].ady)
  {
    if (dfs(i, target, isSpecial) == 1)
    {
      return 1;
    }
    
  }

  return 0;

}

void init(int n, int k) 
{
  g.resize(n);

  for (int i = 0; i < k; i++)
  {
    g[i].special = true;
    
    if (i != k - 1)
    {
      g[i].ady.push_back(i + 1);
    }
    
  }
  
}

int add_teleporter(int u, int v) 
{
  g[u].ady.push_back(v);

  int resp = 0;

  resp = dfs(v, u, false);
  
  return resp;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer[1]
2 Halted 0 ms 0 KB -