#include <cstdio>
#include <utility>
#include <bits/stdc++.h>
#include "coprobber.h"
using namespace std;
const int MAX_N=500;
int pos;
map<array<int, 2>, int> mp;
int state[500][500][2];
vector<vector<int>> g(500);
int calc(int x, int y, int player){
if(x==y&&player==0) return state[x][y][player]=x;
else if(x==y)return state[x][y][player]=-1;
if(state[x][y][player]!=-2)return state[x][y][player];
if(player==0){
int c=0;
state[x][y][player]=-1;
for(auto i: g[x]){
if(calc(i, y, 1)==-1){
state[x][y][0]=i;
c++;
}
}
if(!c) state[x][y][player]=-1;
}
else{
int c=0;
state[x][y][player]=0;
for(auto i: g[y]){
if(calc(x, i, 0)==-1){
state[x][y][1]=i;
c++;
}
}
if(!c) state[x][y][player]=-1;
}
return state[x][y][player];
};
int start(int n, bool a[MAX_N][MAX_N]) {
for(int i=0; i<n; i++){
for(int l=0; l<n; l++){
state[i][l][0]=-2;
state[i][l][1]=-2;
if(a[i][l]){
g[i].push_back(l);
}
}
}
for(int i=0; i<n; i++){
int flag=1;
for(int l=0; l<n; l++){
if(calc(i, l, 1)!=-1){
flag=0;
}
}
if(flag)
return pos=i;
}
return -1;
}
int nextMove(int R) {
return pos = calc(pos, R, 0);
}
Compilation message
coprobber.cpp:10:11: error: redefinition of 'const int MAX_N'
10 | const int MAX_N=500;
| ^~~~~
In file included from coprobber.cpp:5:
coprobber.h:4:11: note: 'const int MAX_N' previously defined here
4 | const int MAX_N = 500;
| ^~~~~