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;
const int MAXN = 510;
vector <int> g[MAXN];
int pai[MAXN];
int h[MAXN];
vector <pair <int, int>> backedges;
void dfs(int v, int p){
pai[v] = p;
for(auto x : g[v]){
if(x == p) continue;
if(pai[v] != -1){
backedges.push_back({v, x});
continue;
}
h[x] = h[v]+1;
dfs(x, v);
}
return;
}
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])
g[i].push_back(j);
}
}
dfs(1, 1);
int tam = 0;
for(auto [a, b] : backedges){
if(h[a] > h[b]) swap(a, b);
tam = max(tam, h[b]-h[a]+1);
}
return (tam >= 5 ? -1 : 0);
}
int nextMove(int R){
exit(0);
return -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... |