이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "game.h"
using namespace std;
int v, u, n, pth[1500][1500], sz[1500], par[1500], a[1500], dead[1500];
int find(int x) {
	if (v == par[v]) return v;
	return par[v] = find(par[v]);
}
void merge(int x, int y) {
	x = find(x);
	y = find(y);
//	if (x != y) {	
	if (sz[x] < sz[y]) swap(x,y);
	for (int j = 0; j < n; j++) {
		pth[y][j] += sz[x];
		pth[j][y] += sz[x];
	}
	par[y] = x;
	sz[x] += sz[y];
//	}
}
void initialize(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		sz[i] = 1;
	}
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			//if (i != j) pth[i][j] = sz[]*sz[];
			pth[i][j] = 1;
}
int hasEdge(int u, int v) {
	if (pth[v][u] == 1) {
		merge(v,u);
		return 1;
	} 
	else {
		return 0;
		pth[v][u]--;
	}
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |