제출 #105933

#제출 시각아이디문제언어결과실행 시간메모리
105933luciocf경찰관과 강도 (BOI14_coprobber)C++14
16 / 100
50 ms2808 KiB
#include <bits/stdc++.h>
#include "coprobber.h"

using namespace std;

const int maxn = 510;

int n, U=0;
int dist[maxn][maxn];

vector<int> grafo[maxn];

void bfs(int s)
{
	queue<int> fila;

	dist[s][s] = 0; fila.push(s);

	while (!fila.empty())
	{
		int u = fila.front();
		fila.pop();

		for (auto v: grafo[u])
		{
			if (dist[s][v] != -1) continue;

			dist[s][v] = dist[s][u]+1;
			fila.push(v);
		}
	}
}

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++)
    		if (A[i][j])
    			grafo[i].push_back(j);

    memset(dist, -1, sizeof dist);
    for (int i = 0; i < n; i++)
    	bfs(i);

    return 0;
}

int nextMove(int R)
{
    for (auto v: grafo[U])
    {
    	if (dist[v][R] == dist[U][R]-1)
    	{
    		U = v;
    		return v;
    	}
    }
}

컴파일 시 표준 에러 (stderr) 메시지

coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:59:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...