# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1125835 | mingga | Cop and Robber (BOI14_coprobber) | C++17 | 0 ms | 0 KiB |
#include "coprobber.h"
#include "bits/stdc++.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())
const int MOD = 1e9 + 7;
const int inf = 2e9;
bool w[505][505];
bool f[505][505][2];
int vis[505][505][2], opt[505][505];
vector<int> g[505];
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;