제출 #818876

#제출 시각아이디문제언어결과실행 시간메모리
818876farhan132게임 (IOI14_game)C++17
0 / 100
0 ms304 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll , ll> ii; #define ff first #define ss second #define pb push_back #define in insert const ll N = 1505; struct DSU{ vector < int > par; vector < int > sz; void start(int n){ par.resize(n + 1); sz.resize(n + 1, 1); for(int i = 0; i <= n; i++) par[i] = i; } int find(int a){ if(a == par[a]) return a; return par[a] = find(par[a]); } void merge(int x, int y){ x = find(x); y = find(y); if(x == y) return; par[x] = y; sz[y] += sz[x]; return; } }T; ll n; void initialize(int _n) { n = _n; T.start(n); return; } int hasEdge(int u, int v) { if(T.find(u) == T.find(v) || T.sz[T.find(u)] + T.sz[T.find(v)] == n) return 0; T.merge(u, v); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...