Submission #48312

#TimeUsernameProblemLanguageResultExecution timeMemory
48312jeongGame (IOI14_game)C++17
0 / 100
2 ms484 KiB
#include <stdio.h> #define N (1500) int deg[N], par[N]; bool visit[N]; void initialize(int n){for(int i=0; i<n; i++)par[i]=i,deg[i]=n-1,visit[i]=false;} int find(int x){ if(par[x] == x)return x; return par[x] = find(par[x]); } int hasEdge(int u, int v){ u = find(u), v = find(v); if(!visit[u] && !visit[v]){ visit[u]=visit[v]=true; deg[u] += deg[v]-2; deg[v]=0; par[v] = u; return 1; } if(u == v)return 0; else{ if(deg[u] == 0 || deg[v] == 0){ visit[u]=visit[v]=true; deg[u] += deg[v]; deg[v] = 0;par[v] = u; return 1; } return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...