Submission #572648

# Submission time Handle Problem Language Result Execution time Memory
572648 2022-06-04T22:37:19 Z Plurm Game (APIO22_game) C++17
0 / 100
1 ms 464 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> g[1024];

int n, k;
void init(int n, int k) {
  ::n = n;
  ::k = k;
}

int color[1024];
bool dfs(int i) {
  if (color[i] == 1)
    return false;
  color[i] = 1;
  for (int j : g[i]) {
    dfs(j);
  }
  color[i] = 2;
}

int add_teleporter(int u, int v) {
  memset(color, 0, sizeof(color));
  bool ok = true;
  for (int i = 0; i < k; i++) {
    ok &= dfs(i);
  }
  return ok ? 0 : 1;
}

Compilation message

game.cpp: In function 'bool dfs(int)':
game.cpp:21:12: warning: control reaches end of non-void function [-Wreturn-type]
   21 |   color[i] = 2;
      |   ~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -