제출 #613263

#제출 시각아이디문제언어결과실행 시간메모리
613263amunduzbaevCop and Robber (BOI14_coprobber)C++17
0 / 100
2 ms1232 KiB
#include "coprobber.h"
#include "bits/stdc++.h"
using namespace std;
#ifndef EVAL
#include "grader.cpp"
#endif

const int M = 505;
int par[M][M], v;
int used[M][M];

int start(int n, bool a[MAX_N][MAX_N]){
	memset(par, -1, sizeof par);
	for(int i=0;i<n;i++){
		queue<int> q; q.push(i);
		par[i][i] = i;
		while(!q.empty()){
			int u = q.front(); q.pop();
			for(int j=0;j<n;j++){
				if(a[u][j] && par[i][j] == -1){
					par[i][j] = u, q.push(j);
				}
			}
		}
	}
	v = 1;
	return 1;
}

int nextMove(int R){
	if(used[v][R]){
		return -1;
	} else {
		used[v][R] = 1;
	}
	return par[R][v];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...