제출 #938451

#제출 시각아이디문제언어결과실행 시간메모리
938451Ghulam_Junaid경찰관과 강도 (BOI14_coprobber)C++17
0 / 100
146 ms262144 KiB
#include <bits/stdc++.h> using namespace std; #define MAX_N 500 // modify the following functions // you can define global variables and functions int n, dist[MAX_N][MAX_N]; bool edge[MAX_N][MAX_N]; void dfs(int v, int s, int p = -1){ for (int u = 0; u < n; u ++) if (u != p and edge[v][u]){ dist[s][u] = dist[s][v] + 1; dfs(u, s, v); } } int start(int N, bool A[MAX_N][MAX_N]) { n = N; for (int i = 0; i < n; i ++) for (int j = 0; j < n; j ++) edge[i][j] = A[i][j]; for (int i = 0; i < n; i ++) dfs(i, i); return 0; } int cur = 0; int nextMove(int R) { if (dist[cur][R] == 1) return cur; for (int i = 0; i < n; i ++){ if (edge[cur][i] and dist[i][R] < dist[cur][R]) return i; } return cur; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...