Submission #34254

#TimeUsernameProblemLanguageResultExecution timeMemory
34254imaxblueCop and Robber (BOI14_coprobber)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()

int n, m, dp[505][505][2], nxt[505][505];
bool u[505][505][2];
vector<int> v[505];
void dfs(int N, int M, bool B){
	if (u[N][M][B]) return;
	u[N][M][B]=1;
	if (N==M){
		dp[N][M][B]=1;
		return;
	}
	if (B){
		fox(l, v[N].size()){
			dfs(v[N][l], M, !B);
			dp[N][M][B]|=dp[v[N][l]][M][!B];
			if (dp[v[N][l]][M]!=0) nxt[N][M]=v[N][l];
		}
	} else {
		int t=1;
		fox(l, v[M].size()){
			dfs(N, v[M][l], !B);
			t&=dp[N][v[M][l]][!B];
		}
		dp[N][M][B]=0;
	}
}
int start (int N, bool A[][]){
	fox(l, N){
      fox(l2, N){
        if (A[l][l2]) v[l].pb(l2);
      }
	}
	fox(l, N){
		bool f=1;
		fox(l2, N){
			dfs(l, l2, 0);
			if (dp[l][l2][0]==0){
				f=0;
				break;
			}
		}
		if (f){
			return N;
		}
	}
	return -1;
}
int nextMove(int R){
	m=R;
	n=nxt[n][m];
	return n;
}

Compilation message (stderr)

coprobber.cpp: In function 'void dfs(int, int, bool)':
coprobber.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
coprobber.cpp:38:7:
   fox(l, v[N].size()){
       ~~~~~~~~~~~~~~              
coprobber.cpp:38:3: note: in expansion of macro 'fox'
   fox(l, v[N].size()){
   ^~~
coprobber.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
coprobber.cpp:45:7:
   fox(l, v[M].size()){
       ~~~~~~~~~~~~~~              
coprobber.cpp:45:3: note: in expansion of macro 'fox'
   fox(l, v[M].size()){
   ^~~
coprobber.cpp: At global scope:
coprobber.cpp:52:28: error: declaration of 'A' as multidimensional array must have bounds for all dimensions except the first
 int start (int N, bool A[][]){
                            ^
coprobber.cpp: In function 'int start(...)':
coprobber.cpp:53:9: error: 'N' was not declared in this scope
  fox(l, N){
         ^
coprobber.cpp:18:35: note: in definition of macro 'fox'
 #define fox(k, x) for (int k=0; k<x; ++k)
                                   ^
coprobber.cpp:55:13: error: 'A' was not declared in this scope
         if (A[l][l2]) v[l].pb(l2);
             ^
coprobber.cpp:58:9: error: 'N' was not declared in this scope
  fox(l, N){
         ^
coprobber.cpp:18:35: note: in definition of macro 'fox'
 #define fox(k, x) for (int k=0; k<x; ++k)
                                   ^