Submission #193362

#TimeUsernameProblemLanguageResultExecution timeMemory
193362mohammadGame (IOI14_game)C++14
42 / 100
1016 ms3040 KiB
/*
░░░░██████████████████
░░▄███████▀▀▀▀▀▀███████▄
░▐████▀▒mohammad▒▀██████▄
░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████
░▐██▒▒▒alwrawrah▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
*/
 
#include<bits/stdc++.h>
#include "game.h"
using namespace std;
 
typedef long long ll ;
const ll oo = 1e13 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7  ;

int N , g[1510][1510] , vis[1510];
bool b = false ;

bool dfs(int u , int v , int p){
	if(u == v) return 1 ;
	if(vis[u] == 1) return false; 
	vis[u] = 1;
	for(int i = 0 ; i < N ; ++i)
		if(i != p && i != u && !g[u][i])
			b |= dfs(i , v , u);
	return false ;
}

void initialize(int n){
	N = n ;
}

int hasEdge(int u, int v) {
	memset(vis , 0 , sizeof vis);
	b = false ;
	g[u][v] = 1 , g[v][u] = 1;
	dfs(u , v , -1);
	if(!b) g[u][v] = 0 , g[v][u] = 0;
	return !b;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...