Submission #926487

# Submission time Handle Problem Language Result Execution time Memory
926487 2024-02-13T06:05:29 Z Cutebol Game (IOI14_game) C++17
0 / 100
0 ms 348 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std ;

const int N = 1505 ;
const int inf = 1e9 ;

int n ;
set <int> g[N] ;
bool vis[N] ;

void initialize(int m) {
	n = m ;
	for ( int i = 1 ; i <= n ; i ++ ){
		for ( int j = i + 1 ; j <= n ; j ++ ){
			g[i].insert(j) ;
			g[j].insert(i) ;
		}
	}
}

void dfs ( int v , int a , int b ){
	vis[v] = 1 ;
	for ( auto to : g[v] ){
		if ( (v == a && to == b) || (v == b && to == a) || vis[to] ) continue ;
		dfs(to,a,b) ;
	}
}

int hasEdge(int u, int v) {
    if ( u > v ) swap ( u , v ) ;
    for ( int i = 1 ; i <= n ; i ++ ) vis[i] = 0 ;
    dfs(u,u,v) ;
    if ( vis[v] ){
		g[u].erase(v) ;
		g[v].erase(u) ;
		return 0 ;
	}
	return 1 ;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -