답안 #955511

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
955511 2024-03-30T17:15:01 Z mdbrnowski 경찰관과 강도 (BOI14_coprobber) C++17
0 / 100
1 ms 344 KB
#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.assign(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;
    }
    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[C][i] == 1 && dist[R][i] < closest)
            closest = dist[R][i], C = i;
    }
    if (closest == 1)
        return prev_C;
    return C;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB the situation repeated
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB the situation repeated
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB the situation repeated
4 Halted 0 ms 0 KB -