제출 #770973

#제출 시각아이디문제언어결과실행 시간메모리
770973loctildore게임 (IOI14_game)C++14
100 / 100
314 ms25800 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; // trans rights #define ll long long #define f first #define s second #define endl '\n' #define all(x) begin(x), end(x) int par[1569]; vector<int> grp[1569]; int done[1569][1569]; int fnd(int x) { return x == par[x] ? x : (par[x] = fnd(par[x])); } void initialize(int n) { for (int i = 0; i < n; i++) { par[i] = i; grp[i].push_back(i); } } int hasEdge(int u, int v) { done[u][v] = done[v][u] = true; u = fnd(u); v = fnd(v); if (u == v) return 0; for (auto x : grp[u]) { for (auto y : grp[v]) { if (!done[x][y]) return 0; } } if (grp[u].size() < grp[v].size()) swap(u, v); for (auto i : grp[v]) grp[u].push_back(i); par[v] = u; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...