| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 580361 | joelau | Connecting Supertrees (IOI20_supertrees) | C++14 | 212 ms | 24080 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
int N,ufds[1005], rnk[1005];
vector<int> lst[1005];
int findSet(int i) {
	return ufds[i] == i ? i : ufds[i] = findSet(ufds[i]);
}
void unionSet(int i, int j) {
	int a = findSet(i), b = findSet(j);
	if (a == b) return;
	if (rnk[a] < rnk[b]) ufds[a] = b;
	if (rnk[a] > rnk[b]) ufds[b] = a;
	if (rnk[a] == rnk[b]) ufds[a] = b, rnk[b]++;
}
int construct(vector<vector<int>> p) {
	N = p.size();
	for (int i = 0; i < N; ++i) ufds[i] = i, rnk[i] = 1;
	for (int i = 0; i < N; ++i) for (int j = 0; j < N; ++j) if (p[i][j] == 2) unionSet(i,j);
	for (int i = 0; i < N; ++i) for (int j = 0; j < N; ++j) if (i != j) {
		if (p[i][j] == 2 && findSet(i) != findSet(j)) return 0;
		if (p[i][j] == 0 && findSet(i) == findSet(j)) return 0;
	}
	vector< vector<int> > ans(N, vector<int>(N,0));
	for (int i = 0; i < N; ++i) lst[findSet(i)].push_back(i);
	for (int i = 0; i < N; ++i) {
		if (lst[i].size() == 2) return 0;
		if (lst[i].size() >= 3) {
			for (int j = 1; j < lst[i].size(); ++j) ans[lst[i][j-1]][lst[i][j]] = ans[lst[i][j]][lst[i][j-1]] = 1;
			ans[lst[i].front()][lst[i].back()] = ans[lst[i].back()][lst[i].front()] = 1;
		}
	}
	build(ans);
	return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
