Submission #309733

#TimeUsernameProblemLanguageResultExecution timeMemory
309733nicolaalexandraCop and Robber (BOI14_coprobber)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "coprobber.h" #define DIM 510 using namespace std; int C,R; struct stare{ int c,r,t; }; deque <stare> d; int dp[DIM][DIM][2],fth[DIM][DIM]; int start (int n, bool a[MAX_N][MAX_N]){ /// stari de pierdere / de castig /// C,R,0/1 - unde se afla politistu si hotu si cine a facut ultima miscare /// C,C,0/1 - stare de castig for (int i=0;i<n;i++){ dp[i][i][0] = dp[i][i][1] = 1; d.push_back({i,i,0}); d.push_back({i,i,1}); } while (!d.empty()){ int c = d.front().c, r = d.front().r, t = d.front().t; d.pop_front(); if (!t){ /// trb sa mute hotu for (int i=0;i<n;i++){ if (i == r || !a[r][i] || dp[c][i][1]) continue; /// daca toti vecinii lui i au stare de castig atunci si asta e stare de castig int ok = 1; for (int j=0;j<n;j++) if (a[i][j] && !dp[c][j][0]){ ok = 0; break; } if (ok){ dp[c][i][1] = 1; d.push_back({c,i,1}); }} } else { /// politistul se muta sau sta pe loc for (int i=0;i<n;i++){ if ((!a[c][i] && i != c) || dp[i][r][0]) continue; int ok = 0; for (int j=0;j<n;j++) if (a[i][j] && dp[j][r][1]) ok = 1; if (ok){ dp[i][r][0] = 1; fth[i][r] = c; /// unde ma duc din starea asta d.push_back({i,r,0}); }}}} for (int i=0;i<n;i++){ int ok = 1; for (int j=0;j<n;j++) if (!dp[i][j][0]){ ok = 0; break; } if (ok) return i; } return -1; } int nextMove (int R){ C = fth[C][R]; return C; }

Compilation message (stderr)

coprobber.cpp:13:26: error: 'MAX_N' was not declared in this scope
   13 | int start (int n, bool a[MAX_N][MAX_N]){
      |                          ^~~~~
coprobber.cpp:13:33: error: 'MAX_N' was not declared in this scope
   13 | int start (int n, bool a[MAX_N][MAX_N]){
      |                                 ^~~~~
coprobber.cpp: In function 'int start(...)':
coprobber.cpp:18:20: error: 'n' was not declared in this scope
   18 |     for (int i=0;i<n;i++){
      |                    ^
coprobber.cpp:29:28: error: 'n' was not declared in this scope
   29 |             for (int i=0;i<n;i++){
      |                            ^
coprobber.cpp:30:32: error: 'a' was not declared in this scope
   30 |                 if (i == r || !a[r][i] || dp[c][i][1])
      |                                ^
coprobber.cpp:36:25: error: 'a' was not declared in this scope
   36 |                     if (a[i][j] && !dp[c][j][0]){
      |                         ^
coprobber.cpp:47:28: error: 'n' was not declared in this scope
   47 |             for (int i=0;i<n;i++){
      |                            ^
coprobber.cpp:48:23: error: 'a' was not declared in this scope
   48 |                 if ((!a[c][i] && i != c) || dp[i][r][0])
      |                       ^
coprobber.cpp:53:25: error: 'a' was not declared in this scope
   53 |                     if (a[i][j] && dp[j][r][1])
      |                         ^
coprobber.cpp:61:20: error: 'n' was not declared in this scope
   61 |     for (int i=0;i<n;i++){
      |                    ^