제출 #926488

#제출 시각아이디문제언어결과실행 시간메모리
926488Cutebol게임 (IOI14_game)C++17
42 / 100
1056 ms12888 KiB
#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 = 0 ; 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 = 0 ; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...