제출 #83341

#제출 시각아이디문제언어결과실행 시간메모리
83341farukkastamonuda게임 (IOI14_game)C++14
0 / 100
2 ms544 KiB
#include "game.h" #include <bits/stdc++.h> #define li 1505 #define inf 2000001000 #define md 1000000007 #define lo long long #define fi first #define se second #define mp make_pair #define pb push_back #define ii pair<lo int,lo int> using namespace std; int A[li],vis[li],N,sz[li],fa[li]; int dsu(int x){ if(fa[x]==x) return x; return fa[x]=dsu(fa[x]); } void union1(int u,int v){ if(sz[v]>sz[u]) swap(u,v); sz[u]+=sz[v]; fa[v]=u; sz[v]=0; } int hasEdge(int u,int v){ if(A[u]==N-2 && vis[u]==0){ vis[u]=1; vis[v]=1; return 1; } if(A[v]==N-2 && vis[v]==0){ vis[v]=1; vis[u]=1; return 1; } int seh1=dsu(u); int seh2=dsu(v); if(seh1==seh2){ vis[u]=1; vis[v]=1; return 1; } if(sz[seh1]+sz[seh2]==N){ A[u]++; A[v]++; return 0; } vis[u]=1; vis[v]=1; union1(u,v); return 1; } void initialize(int n){ N=n; for(int i=0;i<N;i++){ fa[i]=i; sz[i]=1; } } //~ int main(){ //~ initialize(4); //~ return 0; //~ }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...