# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
90139 | nikolapesic2802 | Cop and Robber (BOI14_coprobber) | C++14 | 59 ms | 7672 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;
#define pb push_back
pair<int,int> dp[MAX_N][MAX_N][2];
vector<vector<int> > graf(MAX_N);
int visited[MAX_N][MAX_N][2];
int calc(int cop,int robber,int move)
{
if(visited[cop][robber][move]==2)
return dp[cop][robber][move].first;
//printf("Racunam %i %i %i\n",cop,robber,move);
visited[cop][robber][move]=1;
if(move==0)
{
if(visited[cop][robber][1]==0||visited[cop][robber][1]==2)
{
int d=calc(cop,robber,1);
if(d!=-1)
{
d++;
if(dp[cop][robber][move].first==-1||dp[cop][robber][move].first>d)
dp[cop][robber][move]=make_pair(d,cop);
}
}
for(auto p:graf[cop])
{
if(visited[p][robber][1]==1)
continue;
int d=calc(p,robber,1);
# | 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... |