Submission #779123

# Submission time Handle Problem Language Result Execution time Memory
779123 2023-07-11T08:05:24 Z Josia Connecting Supertrees (IOI20_supertrees) C++17
11 / 100
160 ms 21948 KB
#include "supertrees.h"
#include <vector>
#include <bits/stdc++.h>


using namespace std;


int construct(std::vector<std::vector<int>> p) {
	int n = p.size();
	vector<vector<int>> answer(n, vector<int>(n));

	vector<int> vals;

	for (int i = 0; i<n; i++) {
		bool isZero = p[i][0]==0;
		for (int j = 0; j<n; j++) {
			if ((p[i][j] == 0) != isZero) return 0;
		}
		if (!isZero) vals.push_back(i);
	}

	for (int i = 0; i<(int)(vals.size())-1; i++) {
		answer[i][i+1] = 1;
		answer[i+1][i] = 1;
	}

	build(answer);
	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 1108 KB Output is correct
7 Correct 160 ms 21948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 1108 KB Output is correct
7 Correct 160 ms 21948 KB Output is correct
8 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 1108 KB Output is correct
7 Correct 160 ms 21948 KB Output is correct
8 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 7 ms 1108 KB Output is correct
7 Correct 160 ms 21948 KB Output is correct
8 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
9 Halted 0 ms 0 KB -