# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
202505 | stefanbalaz2 | Cop and Robber (BOI14_coprobber) | C++14 | 5 ms | 376 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 "coprobber.h"
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int maxn=510;
int dep[maxn],pos[maxn],e;
vector<int>vect[maxn];
void go(int x,int prv,int dp){
dep[x]=dp;
pos[x]=1;
for(int i=0;i<vect[x].size();i++){
int id=vect[x][i];
if(id==prv)continue;
if(pos[id] && dep[id]>dep[x])continue;
if(pos[id] && dep[id]<dep[x])
if(dep[x]-dep[id]+1>3)e=1;
if(pos[id])continue;
go(id,x,dp+1);
}
}
int start(int N, bool A[MAX_N][MAX_N])
{
for(int i=0;i<N;i++)
for(int j=0;j<N;j++)
if(A[i][j])vect[i].pb(j);
go(0,-1,1);
if(e)return -1;
return 0;
}
int nextMove(int R)
{
return -1;
}
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... |