Submission #1083961

# Submission time Handle Problem Language Result Execution time Memory
1083961 2024-09-04T16:10:29 Z nickolasarapidis Connecting Supertrees (IOI20_supertrees) C++17
0 / 100
1 ms 348 KB
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;

int construct(vector<vector<int>> p){
	int N = p.size(), cnt = 0;

	vector<vector<int>> b(N, vector<int>(N, 0));

	vector<vector<int>> curPaths(N, vector<int>(N, 0));
	vector<vector<bool>> satisfied(N, vector<bool>(N, false));

	vector<int> adj[N];

	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(i == j){
				curPaths[i][j] = 1;
				satisfied[i][j] = true;
				cnt++;
			}

			if(p[i][j] == 0){
				satisfied[i][j] = true;
				cnt++;
			}
		}
	}

	if(cnt == N*N){
		build(b);
		return 1;
	}

	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(satisfied[i][j]) continue;

			for(int k = 0; k < N; k++){
				if(j == k) continue;
				if(b[j][k] == 1) continue;
				if(p[j][k] == p[i][k]){
					b[i][k] = 1;
				}
			}
		}
	}

	build(b);

	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB b[0][0] is not 0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB b[0][0] is not 0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Answer gives possible 1 while actual possible 0
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB b is not symmetric: b[0][2] (1) != b[2][0] (0)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB b[0][0] is not 0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB b[0][0] is not 0
3 Halted 0 ms 0 KB -