제출 #434063

#제출 시각아이디문제언어결과실행 시간메모리
434063Apiram게임 (IOI14_game)C++14
0 / 100
5 ms8148 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; vector<int>parent(1e6); vector<int>siz(1e6); void makesets(int v){ parent[v]=v; siz[v]=1; } int findsets (int v){ if (v==parent[v])return v; parent[v]=findsets(parent[v]); return parent[v]; } void unionset(int a,int b){ a = findsets(a); b =findsets(b); if (a==b)return; if (siz[a]<siz[b])swap(a,b); siz[a]+=siz[b]; parent[b]=a; } void initialize(int n) { for (int i=0;i<n;++i){ makesets(i); } } int hasEdge(int u, int v) { if (findsets(u)==findsets(v)) return 1; else { unionset(u,v); return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...