# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
938348 | Sir_Ahmed_Imran | Cop and Robber (BOI14_coprobber) | C++17 | 0 ms | 0 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.
///~~~LOTA~~~///
#include "coprobber.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define append push_back
#define add insert
#define nl "\n"
#define ff first
#define ss second
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL)
#define N 501
int r;
int dept[N];
vector<int> a[N];
void dfs(int v){
for(auto& i:a[v]){
if(dept[i])
r=max(r,dept[v]-dept[i]);
else{
dept[i]=dept[v]+1;
dfs(i);
}
}
}
int start(int n,bool g[N][N]){
for(int i=0;i<n;i++)
for(int j=r=0;j<n;j++)
if(g[i][j]) a[i].append(j);
dept[0]=1;
dfs(0);
if(r>3) return -1;
return 0;
}
int nextMove(int v){
return -1;
}