답안 #823072

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

using namespace std;

const int MAXN = 1e5 + 10;

int f[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);
	}

	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];

		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] ^ (f[i] == f[j]))
				return 0;

	build(answer);
	return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 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 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 6 ms 1108 KB Output is correct
7 Correct 160 ms 21952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 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 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 6 ms 1108 KB Output is correct
7 Correct 160 ms 21952 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 6 ms 1108 KB Output is correct
13 Correct 155 ms 22024 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 3 ms 724 KB Output is correct
17 Correct 69 ms 12044 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 41 ms 6084 KB Output is correct
21 Correct 155 ms 22348 KB Output is correct
22 Correct 155 ms 22392 KB Output is correct
23 Correct 162 ms 22348 KB Output is correct
24 Correct 177 ms 22332 KB Output is correct
25 Correct 66 ms 12516 KB Output is correct
26 Correct 66 ms 12432 KB Output is correct
27 Correct 163 ms 22448 KB Output is correct
28 Correct 159 ms 22424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 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 212 KB Output is correct
5 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
6 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 212 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 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 6 ms 1108 KB Output is correct
7 Correct 160 ms 21952 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 6 ms 1108 KB Output is correct
13 Correct 155 ms 22024 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 3 ms 724 KB Output is correct
17 Correct 69 ms 12044 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 41 ms 6084 KB Output is correct
21 Correct 155 ms 22348 KB Output is correct
22 Correct 155 ms 22392 KB Output is correct
23 Correct 162 ms 22348 KB Output is correct
24 Correct 177 ms 22332 KB Output is correct
25 Correct 66 ms 12516 KB Output is correct
26 Correct 66 ms 12432 KB Output is correct
27 Correct 163 ms 22448 KB Output is correct
28 Correct 159 ms 22424 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 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 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 6 ms 1108 KB Output is correct
7 Correct 160 ms 21952 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 6 ms 1108 KB Output is correct
13 Correct 155 ms 22024 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 3 ms 724 KB Output is correct
17 Correct 69 ms 12044 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 41 ms 6084 KB Output is correct
21 Correct 155 ms 22348 KB Output is correct
22 Correct 155 ms 22392 KB Output is correct
23 Correct 162 ms 22348 KB Output is correct
24 Correct 177 ms 22332 KB Output is correct
25 Correct 66 ms 12516 KB Output is correct
26 Correct 66 ms 12432 KB Output is correct
27 Correct 163 ms 22448 KB Output is correct
28 Correct 159 ms 22424 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
34 Halted 0 ms 0 KB -