# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1075824 | raphaelp | Cop and Robber (BOI14_coprobber) | C++14 | 3031 ms | 1672 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "coprobber.h"
using namespace std;
vector<vector<int>> AR;
int pos = 0;
int start(int N, bool A[MAX_N][MAX_N])
{
AR.assign(N, {});
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if (A[i][j])
{
AR[i].push_back(j);
AR[j].push_back(i);
}
}
}
return 0;
}
bool dfs(int x, int p, int R)
{
if (x == R)
return 1;
for (int i = 0; i < AR[x].size(); i++)
{
if (AR[x][i] == p)
continue;
if (dfs(AR[x][i], x, R))
return 1;
}
return 0;
}
int nextMove(int R)
{
for (int i = 0; i < AR[pos].size(); i++)
{
if (dfs(AR[pos][i], pos, R))
{
pos = AR[pos][i];
return pos;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |