Submission #1307348

#TimeUsernameProblemLanguageResultExecution timeMemory
1307348lucaskojimaCop and Robber (BOI14_coprobber)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
#include "coprobber.h"
#define sz(x) (int)size(x)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int N   = 500;

vector<int> adj[N];
int n, p = 0, pai[N];

void dfs(int x, int p) {
  pai[x] = p;
  for (int k : adj[x]) if (k != p) {
    dfs(k, x);
  }
}

bool find(int x, int t) {
  if (x == t) return true;

  bool ok = false;
  for (int k : adj[x]) if (k != pai[x]) {
    ok |= find(k, t);
  }
  return ok;
}

int start(int N, bool A[][]) {
  n = N;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (A[i][j])
        adj[i].push_back(j);

  dfs(0, -1);
  return 0;
}

int nextMove(int R) {
  for (int k : adj[p]) {
    if (k == pai[p]) continue;

    if (find(k, R))
      return p = k;
  }
  return -1;
}

Compilation message (stderr)

coprobber.cpp:36:23: error: declaration of 'A' as multidimensional array must have bounds for all dimensions except the first
   36 | int start(int N, bool A[][]) {
      |                       ^
coprobber.cpp: In function 'int start(...)':
coprobber.cpp:40:11: error: 'A' was not declared in this scope
   40 |       if (A[i][j])
      |           ^