Submission #145761

#TimeUsernameProblemLanguageResultExecution timeMemory
145761letrongdatCop and Robber (BOI14_coprobber)C++17
Compilation error
0 ms0 KiB
#include "coprobber.h"
#include <bits/stdc++.h>
const int maxN = 510;
using namespace std;
#define forn(i, a, b)   for(int i=a; i<=b; ++i)
#define repn(i, a, b)   for(int i=a; i <b; ++i)

int cur;
int mov[maxN][maxN], deg[maxN][maxN];
int W[maxN][maxN][2];
int start(int N, bool A[max_N][max_N]) {
    queue < tuple < int, int, int > > q;
    repn(i, 0, N) repn(j, 0, N) repn(k, 0, N) deg[i][j] += A[j][k];
    repn(i, 0, N) forn(turn, 0, 1) {
        W[i][i][turn] = 1;
        q.push({i, i, turn});
    }
    while (q.size()) {
        int c, r, t;
        tie(c, r, t) = q.front();
        q.pop();
        repn(i, 0, N) {
            if (t) {
                if ( (A[c][i] || i == c) && !W[i][r][0]) {
                    mov[i][r] = c;
                    W[i][r][0] = true;
                    q.push({i, r, 0});
                }
                continue;
            }
            if (A[r][i] && !W[c][i][1] && --deg[c][i] < 1) {
                W[c][i][1] = true;
                q.push({c, i, 1});
            }
        }
    }
    bool ok = true;
    repn(i, 0, N) ok &= W[0][i][0];
    return (ok ? 0 : -1);
}
int nextMove(int R) {
    return cur = mov[cur][R];
}

Compilation message (stderr)

coprobber.cpp:11:25: error: 'max_N' was not declared in this scope
 int start(int N, bool A[max_N][max_N]) {
                         ^~~~~
coprobber.cpp:11:25: note: suggested alternative: 'maxN'
 int start(int N, bool A[max_N][max_N]) {
                         ^~~~~
                         maxN
coprobber.cpp:11:32: error: 'max_N' was not declared in this scope
 int start(int N, bool A[max_N][max_N]) {
                                ^~~~~
coprobber.cpp:11:32: note: suggested alternative: 'maxN'
 int start(int N, bool A[max_N][max_N]) {
                                ^~~~~
                                maxN
coprobber.cpp: In function 'int start(...)':
coprobber.cpp:13:16: error: 'N' was not declared in this scope
     repn(i, 0, N) repn(j, 0, N) repn(k, 0, N) deg[i][j] += A[j][k];
                ^
coprobber.cpp:6:41: note: in definition of macro 'repn'
 #define repn(i, a, b)   for(int i=a; i <b; ++i)
                                         ^
coprobber.cpp:13:60: error: 'A' was not declared in this scope
     repn(i, 0, N) repn(j, 0, N) repn(k, 0, N) deg[i][j] += A[j][k];
                                                            ^
coprobber.cpp:14:16: error: 'N' was not declared in this scope
     repn(i, 0, N) forn(turn, 0, 1) {
                ^
coprobber.cpp:6:41: note: in definition of macro 'repn'
 #define repn(i, a, b)   for(int i=a; i <b; ++i)
                                         ^
coprobber.cpp:22:20: error: 'N' was not declared in this scope
         repn(i, 0, N) {
                    ^
coprobber.cpp:6:41: note: in definition of macro 'repn'
 #define repn(i, a, b)   for(int i=a; i <b; ++i)
                                         ^
coprobber.cpp:24:23: error: 'A' was not declared in this scope
                 if ( (A[c][i] || i == c) && !W[i][r][0]) {
                       ^
coprobber.cpp:31:17: error: 'A' was not declared in this scope
             if (A[r][i] && !W[c][i][1] && --deg[c][i] < 1) {
                 ^
coprobber.cpp:38:16: error: 'N' was not declared in this scope
     repn(i, 0, N) ok &= W[0][i][0];
                ^
coprobber.cpp:6:41: note: in definition of macro 'repn'
 #define repn(i, a, b)   for(int i=a; i <b; ++i)
                                         ^