제출 #41360

#제출 시각아이디문제언어결과실행 시간메모리
41360gabrielsimoes경찰관과 강도 (BOI14_coprobber)C++14
16 / 100
232 ms262144 KiB
#include "coprobber.h" #include <vector> int pre[MAX_N], pos[MAX_N], t = 0; int prev[MAX_N]; std::vector<int> g[MAX_N]; void dfs(int cur) { pre[cur] = t++; for (int nx : g[cur]) { if (nx != prev[cur]) { prev[nx] = cur; dfs(nx); } } pos[cur] = t++; } int start(int N, bool A[MAX_N][MAX_N]) { for (int i = 0; i < N; i++) { for (int k = 0; k < N; k++) { if (A[i][k]) { g[i].push_back(k); } } } dfs(0); return 0; } int x = 0; int nextMove(int R) { for (int nx : g[x]) { if (nx != prev[x]) { if (pre[nx] <= pre[R] && pos[nx] >= pos[R]) { return x = nx; } } } return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...