제출 #1082172

#제출 시각아이디문제언어결과실행 시간메모리
1082172logangd게임 (IOI14_game)C++14
15 / 100
1 ms836 KiB
#include "game.h" #include<iostream> using namespace std; int N,c[1500],d[1500],ar[1500][1500]; void dfs(int u){ if(c[u]==d[u]){ for(int i=0;i<N;i++){ if(ar[u][i]&&c[i]!=d[i]){ c[i]++; dfs(i); } } } } void initialize(int n){ N=n; for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(i!=j)ar[i][j]=1; for(int i=0;i<n;i++)c[i]=1,d[i]=n-1; } int hasEdge(int u,int v){ if(c[u]!=d[u]&&c[v]!=d[v]){ d[u]--; d[v]--; ar[u][v]=ar[v][u]=0; dfs(u); dfs(v); return 0; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...