Submission #983068

# Submission time Handle Problem Language Result Execution time Memory
983068 2024-05-15T07:43:10 Z Muhammad_Aneeq Game (APIO22_game) C++17
0 / 100
4 ms 14424 KB
// #include "game.h"
#include <vector>
#include <set>
using namespace std;
int N,K;
int const MAXN=300000+10;
set<int>nei[MAXN]={};
bool vis[MAXN]={};
int cur=1;
void init(int n, int k) 
{
  N=n,K=k;
  for (int i=0;i<k-1;i++)
    nei[i].insert(i+1);
}
bool check_cycle(int n)
{
  vis[n]=1;
  for (auto i:nei[n])
  {
    if (vis[i]==cur&&i<K)
      return 1;
    if (vis[i])
      continue;
    if (check_cycle(i))
      return 1;
  }
  return 0;
}
int add_teleporter(int u, int v) 
{
  nei[u].insert(v);
  for (int i=0;i<K;i++)
  {
    if (vis[i]==0&&check_cycle) 
      return 1;
    cur++;
  }
  return 0;
}

Compilation message

game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:35:20: warning: the address of 'bool check_cycle(int)' will never be NULL [-Waddress]
   35 |     if (vis[i]==0&&check_cycle)
      |                    ^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14424 KB Output is correct
2 Incorrect 4 ms 14424 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14424 KB Output is correct
2 Incorrect 4 ms 14424 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14424 KB Output is correct
2 Incorrect 4 ms 14424 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14424 KB Output is correct
2 Incorrect 4 ms 14424 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14424 KB Output is correct
2 Incorrect 4 ms 14424 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -