Submission #346376

#TimeUsernameProblemLanguageResultExecution timeMemory
346376salehCop and Robber (BOI14_coprobber)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ft first #define sd second using namespace std; typedef pair<int, int> pii; typedef pair<int, pii> tip; const int MAXN = 500 + 3; int st, dd[MAXN], d[MAXN][MAXN], par[MAXN][MAXN]; queue<tip> q; bitset<MAXN> mark[2 + 1][MAXN]; int start(int n, bool *a[MAX_N]) { for (int i = 0; i < 2; i++) for (int j = 0; j < n; j++) { q.push({i, {j, j}}); mark[i][j][j] = true; } for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) dd[i] += a[i][j]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) d[i][j] = dd[j]; while (!q.empty()) { tip x = q.front(); q.pop(); if (x.ft == 0) { for (int i = 0; i < n; i++) if (a[i][x.sd.sd] && --d[x.sd.ft][i] == 0) { q.push({1, {x.sd.ft, i}}); mark[1][x.sd.ft][i] = true; } } else { for (int i = 0; i < n; i++) if (i == x.sd.ft || a[i][x.sd.ft] == 1) if (!mark[0][i][x.sd.sd]) { q.push({0, {i, x.sd.sd}}); par[i][x.sd.sd] = x.sd.ft; mark[0][i][x.sd.sd] = true; } } } for (int i = 0; i < n; i++) { bool z = true; for (int j = 0; j < n; j++) z &= mark[0][i][j]; if (z) return st = i; } return -1; } int nextMove(int r) { return st = par[st][r]; }

Compilation message (stderr)

coprobber.cpp:29:26: error: 'MAX_N' was not declared in this scope; did you mean 'MAXN'?
   29 | int start(int n, bool *a[MAX_N]) {
      |                          ^~~~~
      |                          MAXN
coprobber.cpp: In function 'int start(...)':
coprobber.cpp:30:50: error: 'n' was not declared in this scope
   30 |  for (int i = 0; i < 2; i++) for (int j = 0; j < n; j++) {
      |                                                  ^
coprobber.cpp:34:22: error: 'n' was not declared in this scope
   34 |  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) dd[i] += a[i][j];
      |                      ^
coprobber.cpp:34:67: error: 'a' was not declared in this scope
   34 |  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) dd[i] += a[i][j];
      |                                                                   ^
coprobber.cpp:35:22: error: 'n' was not declared in this scope
   35 |  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) d[i][j] = dd[j];
      |                      ^
coprobber.cpp:40:24: error: 'n' was not declared in this scope
   40 |    for (int i = 0; i < n; i++) if (a[i][x.sd.sd] && --d[x.sd.ft][i] == 0) {
      |                        ^
coprobber.cpp:40:36: error: 'a' was not declared in this scope
   40 |    for (int i = 0; i < n; i++) if (a[i][x.sd.sd] && --d[x.sd.ft][i] == 0) {
      |                                    ^
coprobber.cpp:45:24: error: 'n' was not declared in this scope
   45 |    for (int i = 0; i < n; i++) if (i == x.sd.ft || a[i][x.sd.ft] == 1) if (!mark[0][i][x.sd.sd]) {
      |                        ^
coprobber.cpp:45:52: error: 'a' was not declared in this scope
   45 |    for (int i = 0; i < n; i++) if (i == x.sd.ft || a[i][x.sd.ft] == 1) if (!mark[0][i][x.sd.sd]) {
      |                                                    ^
coprobber.cpp:52:22: error: 'n' was not declared in this scope
   52 |  for (int i = 0; i < n; i++) {
      |                      ^