Submission #1125830

#TimeUsernameProblemLanguageResultExecution timeMemory
1125830minggaCop and Robber (BOI14_coprobber)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "coprobber.h" using namespace std; #define ln "\n" #define pb push_back #define fi first #define se second #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) // #define int long long const int MOD = 1e9 + 7; const int inf = 2e9; const int N = 505; bool w[N][N]; bool f[N][N][2]; int vis[N][N][2], opt[N][N]; vector<int> g[N]; int pre; bool calc(int u, int v, int steps) { if(u == v) { return f[u][v][steps] = 1; } if(vis[u][v][steps]) return f[u][v][steps]; vis[u][v][steps] = 1; if(steps & 1) { bool ans = 0; for(int x : g[u]) { if(vis[x][v][0] == 1) { continue; } if(calc(x, v, 0)) opt[u][v] = x; ans = ans | calc(x, v, 0); } if(vis[u][v][0] != 1) ans = ans | calc(u, v, 0); if(calc(u, v, 0)) opt[u] = u; vis[u][v][steps] = 2; return f[u][v][steps] = ans; } else { bool ans = 1; for(int x : g[v]) { if(vis[u][x][1] == 1) return 0; ans = ans & d calc(u, x, 1); } vis[u][v][steps] = 2; return f[u][v][steps] = ans; } } int start(int n, bool a[N][N]) { for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { w[i][j] = a[i][j]; if(w[i][j]) { g[i].pb(j); } } } int ans = -1; for(int i = 0; i < n; i++) { bool cur = 1; for(int j = 0; j < n; j++) { cur = cur & calc(i, j, 1); } if(cur) { pre = i; return i; } } return ans; } int nextMove(int x) { pre = opt[pre][x]; return pre; }

Compilation message (stderr)

coprobber.cpp: In function 'bool calc(int, int, int)':
coprobber.cpp:38:42: error: incompatible types in assignment of 'int' to 'int [505]'
   38 |                 if(calc(u, v, 0)) opt[u] = u;
      |                                   ~~~~~~~^~~
coprobber.cpp:45:37: error: 'd' was not declared in this scope
   45 |                         ans = ans & d calc(u, x, 1);
      |                                     ^