Submission #208688

#TimeUsernameProblemLanguageResultExecution timeMemory
208688E869120Cop and Robber (BOI14_coprobber)C++14
0 / 100
5 ms376 KiB
#include "coprobber.h" #include <vector> using namespace std; int N, M; 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++; } } } M = cnt; 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) { if (N == M - 1) { 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; } 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...