답안 #823087

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
823087 2023-08-12T07:48:37 Z Sohsoh84 슈퍼트리 잇기 (IOI20_supertrees) C++17
0 / 100
1 ms 308 KB
#include "supertrees.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e5 + 10;

int f[MAXN], sz[MAXN], L[MAXN];

int construct(vector<vector<int>> p) {
	int n = p.size();
	vector<vector<int>> answer;
	for (int i = 0; i < n; i++) {
		vector<int> row;
		row.resize(n, 0);
		answer.push_back(row);
	}

	sz[0] = 1;
	for (int i = 1; i < n; i++) {
		int lst = i;
		for (int j = 0; j < i; j++)
			if (p[i][j])
				if (lst == i) lst = j;

		f[i] = i;
		f[i] = f[lst];
		L[f[i]] = i;
		sz[f[i]]++;

		if (lst < i) answer[i][lst] = answer[lst][i] = 1;
	}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if ((p[i][j] > 0) ^ (f[i] == f[j]))
				return 0;

	for (int i = 0; i < n; i++) {
		if (sz[i] == 2)
			return 0;
	
		if (sz[i] > 2)
			answer[L[i]][i] = answer[i][L[i]] = 1;
	}

	build(answer);
	return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 224 KB Output is correct
5 Incorrect 0 ms 212 KB Too few ways to get from 0 to 1, should be 2 found 1
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 304 KB Output is correct
2 Incorrect 1 ms 212 KB Too few ways to get from 0 to 1, should be 2 found 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -