Submission #398799

# Submission time Handle Problem Language Result Execution time Memory
398799 2021-05-04T20:19:38 Z faresbasbs Cop and Robber (BOI14_coprobber) C++14
0 / 100
1 ms 200 KB
#include <bits/stdc++.h>
#include "coprobber.h"
using namespace std;
int n,curr,h[501],out[501],in[501];
vector<int> graph[501];
bool bad,seen[501];

void dfs(int curr , int par , int hi){
	h[curr] = hi;
	for(auto i : graph[curr]){
		if(i == par){
			continue;
		}
		if(!h[i]){
			dfs(i,curr,hi+1);
			continue;
		}
		if(h[i] < h[curr]){
			out[curr] += 1 , in[i] += 1;
			if(abs(h[i]-h[curr]) > 2){
				bad = 1;
			}
			continue;
		}
	}
	for(auto i : graph[curr]){
		if(h[i] < h[curr]){
			continue;
		}
		if(out[i] && out[curr]){
			bad = 1;
		}
	}
}

int start(int N , bool grid[MAX_N][MAX_N]){
	return -1;
	// n = N;
	// for(int i = 0 ; i < n ; i += 1){
	// 	for(int j = 0 ; j < n ; j += 1){
	// 		if(grid[i][j]){
	// 			graph[i].push_back(j);
	// 		}
	// 	}
	// }
	// dfs(0,0,1);
	// if(bad){
	// 	return -1;
	// }
	// return 0;
}

bool fnd(int pos , int tar){
	seen[pos] = 1;
	if(pos == tar){
		return true;
	}
	for(auto i : graph[pos]){
		if(!seen[i] && fnd(i,tar)){
			return true;
		}
	}
	return false;
}

int nextMove(int r){
	memset(seen,0,sizeof seen);
	seen[curr] = 1;
	for(int i : graph[curr]){
		if(fnd(i,r)){
			return curr = i;
		}
	}
}

Compilation message

coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:74:1: warning: control reaches end of non-void function [-Wreturn-type]
   74 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Cop can catch the robber, but start() returned -1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Cop can catch the robber, but start() returned -1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Cop can catch the robber, but start() returned -1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Cop can catch the robber, but start() returned -1
2 Halted 0 ms 0 KB -