제출 #105622

#제출 시각아이디문제언어결과실행 시간메모리
105622thiago4532경찰관과 강도 (BOI14_coprobber)C++17
0 / 100
215 ms262144 KiB
#include <bits/stdc++.h> #define MAX_N 500 using namespace std; vector<int> grafo[MAX_N]; int dist[MAX_N], pai[MAX_N]; void dfs(int u, int p=0) { pai[u] = p; for(auto v : grafo[u]) { if(v == p) continue; dist[v] = dist[u] + 1; dfs(v, u); } } 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]) grafo[i].push_back(j); } } dfs(0); return 0; } int nextMove(int R) { int p = R; while(pai[p] != 0) p = pai[p]; nextMove(p); return 0; } // don't modify the main function // int main() { // int N; // cin >> N; // bool A[MAX_N][MAX_N]; // for (int i = 0; i < N; i++) { // for (int j = 0; j < N; j++) { // cin >> A[i][j]; // } // } // int P = start(N,A); // cout << P << endl; // int R; // cin >> R; // while (true) { // if (P == R) break; // P = nextMove(R); // cout << P << endl; // if (P == R) break; // cin >> R; // } // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...