Submission #823067

# Submission time Handle Problem Language Result Execution time Memory
823067 2023-08-12T07:33:15 Z Sohsoh84 Connecting Supertrees (IOI20_supertrees) C++17
11 / 100
163 ms 24780 KB
#include "supertrees.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e5 + 10;

int f[MAXN];
vector<int> C[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];
		C[f[i]].push_back(i);

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

	for (int i = 0; i < n; i++)
		for (int e1 : C[i])
			for (int e2 : C[i])
				if (e1 != e2 && !p[e1][e2])
					return 0;

	build(answer);
	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2656 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 8 ms 3560 KB Output is correct
7 Correct 158 ms 24728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2656 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 8 ms 3560 KB Output is correct
7 Correct 158 ms 24728 KB Output is correct
8 Correct 1 ms 2664 KB Output is correct
9 Correct 2 ms 2652 KB Output is correct
10 Correct 2 ms 2656 KB Output is correct
11 Correct 2 ms 2644 KB Output is correct
12 Correct 8 ms 3628 KB Output is correct
13 Correct 163 ms 24780 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 4 ms 3152 KB Output is correct
17 Correct 86 ms 14776 KB Output is correct
18 Incorrect 1 ms 2644 KB Answer gives possible 1 while actual possible 0
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Incorrect 1 ms 2644 KB Answer gives possible 1 while actual possible 0
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Incorrect 1 ms 2644 KB Too few ways to get from 0 to 1, should be 2 found 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2656 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 8 ms 3560 KB Output is correct
7 Correct 158 ms 24728 KB Output is correct
8 Correct 1 ms 2664 KB Output is correct
9 Correct 2 ms 2652 KB Output is correct
10 Correct 2 ms 2656 KB Output is correct
11 Correct 2 ms 2644 KB Output is correct
12 Correct 8 ms 3628 KB Output is correct
13 Correct 163 ms 24780 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 4 ms 3152 KB Output is correct
17 Correct 86 ms 14776 KB Output is correct
18 Incorrect 1 ms 2644 KB Answer gives possible 1 while actual possible 0
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2656 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 8 ms 3560 KB Output is correct
7 Correct 158 ms 24728 KB Output is correct
8 Correct 1 ms 2664 KB Output is correct
9 Correct 2 ms 2652 KB Output is correct
10 Correct 2 ms 2656 KB Output is correct
11 Correct 2 ms 2644 KB Output is correct
12 Correct 8 ms 3628 KB Output is correct
13 Correct 163 ms 24780 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 4 ms 3152 KB Output is correct
17 Correct 86 ms 14776 KB Output is correct
18 Incorrect 1 ms 2644 KB Answer gives possible 1 while actual possible 0
19 Halted 0 ms 0 KB -