이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second
const int inf = 0x3f3f3f3f;
const int mxn = 500;
int n, c;
int g[mxn][mxn], d[mxn][mxn];
int start(int N, bool G[mxn][mxn]){
n = N;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++){
g[i][j] = d[i][j] = !G[i][j] * (inf - 1) + 1;
}
for(int l = 0; l < n; l++)
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++){
d[i][j] = min(d[i][j], d[i][l] + d[l][j]);
}
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++){
if(d[i][j] == inf) return -1;
}
return c = 0;
}
int nextMove(int r){
int ret = c;
for(int i = 0; i < n; i++){
if(g[c][i] && d[i][r] < d[ret][r]) ret = i;
}
for(int i = 0, j = 0; i < n; i++){
j += g[c][i] && d[i][r] == ret;
if(j > 1) return c;
}
return ret;
}
# | 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... |