제출 #911181

#제출 시각아이디문제언어결과실행 시간메모리
911181contest_alt게임 (IOI14_game)C++17
42 / 100
35 ms860 KiB
#include "game.h" namespace Solver { const int MAXN = 80; int adj[MAXN][MAXN]; int n; void init( int N ) { n = N; for( int i = 0 ; i < n ; i++ ){ for( int j = 0 ; j < n ; j++ ) adj[i][j] = 1; adj[i][i] = 0; } } void remove_edge( int u, int v ) { adj[u][v] = adj[v][u] = 0; } void insert_edge( int u, int v ) { adj[u][v] = adj[v][u] = 1; } bool viz[MAXN]; void dfs( int u ) { viz[u] = true; for( int v = 0 ; v < n ; v++ ) if( !viz[v] && adj[u][v] ) dfs( v ); } bool connected( int u, int v ) { for( int i = 0 ; i < n ; i++ ) viz[i] = false; dfs( u ); return viz[v]; } }; void initialize(int n) { Solver::init( n ); } int hasEdge(int u, int v) { Solver::remove_edge( u, v ); bool ret = true; if( Solver::connected( u, v ) ) ret = false; else Solver::insert_edge( u, v ); return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...