제출 #171475

#제출 시각아이디문제언어결과실행 시간메모리
171475gs18103게임 (IOI14_game)C++14
0 / 100
2 ms376 KiB
#include "game.h" #include <bits/stdc++.h> #define fi first #define se second #define eb emplace_back #define em emplace #define all(v) v.begin(), v.end() #define report(x, l, s) stype[x] = s, location[x] = l, chk[x] = true using namespace std; typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; const int MAX = 2020; const int INF = 1 << 30; const ll LINF = 1LL << 60; int cnt; struct UFT { int p[MAX]; void init(int n) {for(int i = 0; i < n; i++) p[i] = i;} int find(int x) { return x == p[x] ? x : p[x] = find(p[x]); } void uni(int x, int y) { p[find(y)] = find(x); } } uft; void initialize(int n) { uft.init(n); cnt = n; } int hasEdge(int u, int v) { if(uft.find(u) == uft.find(v)) return 1; if(cnt > 2) { uft.uni(u, v); cnt--; return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...