# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
250119 | Kevin_Zhang_TW | 경찰관과 강도 (BOI14_coprobber) | C++17 | 1 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "coprobber.h"
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 500
const int inf = 1e9;
// modify the following functions
// you can define global variables and functions
int dp[MAX_N][MAX_N];
int now, n;
bool con[MAX_N][MAX_N];
int start(int n, bool A[MAX_N][MAX_N]) {
int m = 0;
for (int i = 0;i < n;++i)
for (int j = 0;j < n;++j)
dp[i][j] = A[i][j] ? 1 : inf, con[i][j] = A[i][j], dp[i][i] = 0, m += A[i][j];
assert(m == (n-1) * 2);
// for (int i = 0;i < n;++i)
// for (int j = 0;j < n;++j) if (i != j)
// assert(A[i][j]);
for (int a:{1,1,1})
for (int k = 0;k < n;++k)
for (int i = 0;i < n;++i)
for (int j = 0;j < n;++j)
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
return 0;
// int res = 0;
// for (int i = 0;i < n;++i)
// if (dp[i][i] <= n)
// res = max(res, dp[i][i]), cerr << dp[i][i] << '\n';
// if (res > 4) return -1;
//
// return 0;
}
int nextMove(int R) {
if (con[now][R] || now == R)
return now = R;
int go = now, dis = INT_MAX;
for (int i = 0;i < n;++i)
if (con[now][i]) {
dis = min(dis, dp[i][R]);
if (dis == dp[i][R])
go = i;
}
return now = go;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |