제출 #1119871

#제출 시각아이디문제언어결과실행 시간메모리
1119871PagodePaiva경찰관과 강도 (BOI14_coprobber)C++17
0 / 100
1 ms336 KiB
#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){ return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...