Submission #955514

#TimeUsernameProblemLanguageResultExecution timeMemory
955514mdbrnowskiCop and Robber (BOI14_coprobber)C++17
16 / 100
133 ms2732 KiB
#include "coprobber.h" #include <bits/stdc++.h> using namespace std; int n, C = 0; vector<vector<int>> dist; int start(int N, bool A[MAX_N][MAX_N]) { n = N; dist.resize(n, vector<int>(n, 0)); for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) if (A[i][j]) dist[i][j] = dist[j][i] = 1; else dist[i][j] = dist[j][i] = 1e9; } for (int k = 0; k < n; k++) { for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]); } return C; } int nextMove(int R) { int prev_C = C; int closest = 1e9; for (int i = 0; i < n; i++) { if (dist[prev_C][i] == 1 && dist[R][i] < closest) closest = dist[R][i], C = i; } return C; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...