답안 #26189

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
26189 2017-06-28T08:56:21 Z chpipis 경찰관과 강도 (BOI14_coprobber) C++11
0 / 100
3 ms 1408 KB
#include "coprobber.h"
#include <bits/stdc++.h>

using namespace std;

bool mat[MAX_N + 5][MAX_N + 5];
bool visit[MAX_N + 5][MAX_N + 5][2];
bool memo[MAX_N + 5][MAX_N + 5][2];
int n;

bool dp(int o, int r, int f) {
    if (o == r)
        return true;
    if (visit[o][r][f])
        return memo[o][r][f];
    visit[o][r][f] = true;
    if (f == 0) {
        bool win = false;
        for (int i = 0; i < n; i++)
            if (i == o || mat[o][i])
                win |= dp(i, r, f ^ 1);
        memo[o][r][f] = win;
    } else {
        bool win = true;
        for (int i = 0; i < n; i++)
            if (mat[r][i])
                win &= dp(o, i, f ^ 1);
        memo[o][r][f] = win;
    }
    return memo[o][r][f];
}

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++)
            mat[i][j] = A[i][j];
    memset(visit, false, sizeof visit);
    memset(memo, false, sizeof memo);
    int pos = -1;
    for (int i = 0; i < n; i++) {
        bool win = true;
        for (int j = 0; j < n; j++)
            win &= dp(i, j, 0);
        if (win) pos = i;
    }
    return pos;
}

int nextMove(int R) {
    return -1;
}


# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1408 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 Incorrect 3 ms 1408 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 Incorrect 3 ms 1280 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 Incorrect 3 ms 1280 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 -