제출 #208687

#제출 시각아이디문제언어결과실행 시간메모리
208687E869120경찰관과 강도 (BOI14_coprobber)C++14
16 / 100
60 ms1784 KiB
#include "coprobber.h" #include <vector> using namespace std; int N; vector<int> X[509], I, J; int cx = 0; bool used[509]; int start(int NN, bool A[MAX_N][MAX_N]) { N = NN; int cnt = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (A[i][j] == 1) { X[i].push_back(j); if (i < j) cnt++; } } } if (cnt != N - 1) return -1; return 0; } void dfs(int pos, int to) { if (pos == to) { J = I; return; } used[pos] = true; for (int i : X[pos]) { if (used[i] == true) continue; I.push_back(i); dfs(i, to); I.pop_back(); } } int nextMove(int R) { for (int i = 0; i < N; i++) used[i] = false; I.clear(); J.clear(); I.push_back(cx); dfs(cx, R); cx = J[1]; return cx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...