Submission #812975

# Submission time Handle Problem Language Result Execution time Memory
812975 2023-08-07T12:27:31 Z OrazB Connecting Supertrees (IOI20_supertrees) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "supertrees.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ll long long int
#define pii pair <int, int>
#define pb push_back
#define ff first
#define ss second

const int N = 1e3+5;
int T, vis[N][N], cur[N], tp[N];
int b[N][N];
set<int> A[N], B[N];
vector<int> E[N];

int F1(int n, int i, vector<vector<int>> p){
	if (A[cur[i]].find(i) != A[cur[i]].end()) return p[tp[i]] == p[i];
	for (int j = 0; j < n; j++){
		if (i == j) continue;
		if (vis[cur[i]][j] != (p[i][j] == 0)) return 0;
		if (p[i][j] == 1){
			tp[j] = i;
			A[cur[i]].insert(j);
			B[cur[i]].erase(j);
			b[i][j] = b[j][i] = 1;
		}
	}
	return 1;
}

void F2(int n, int i, vector<vector<int>> p){
	++T;
	B[T].insert(i);
	for (int j = 0; j < n; j++){
		if (i == j) continue;
		if (p[i][j] == 0) vis[T][j] = 1;
		else{
			cur[j] = T;
			if (p[i][j] == 1){
				tp[j] = i;
				A[T].insert(j);
				b[i][j] = b[j][i] = 1;
			}else B[T].insert(j);
		}
	}
}

int construct(vector<vector<int>> p){
	int n = p.size();
	for (int i = 0; i < n; i++){
		if (count(all(p[i]), 3)) return 0;
		if (cur[i]){
			int x = F1(n, i, p);
			if (!x) return 0;
		}else F2(n, i, p);
	}
	for (int i = 1; i <= T; i++){
		int lst = *B[i].rbegin();
		for (auto j : B[i]){
			b[lst][j] = b[j][lst] = 1;
			lst = j;
		}
	}
	build(b);
	return 1;

}

// int main ()
// {
// 	ios::sync_with_stdio(false);
// 	cin.tie(0);
// 	int n;
// 	cin >> n;
// 	vector<vector<int>> p(n, vector<int>(n));
// 	for (int i = 0; i < n; i++){
// 		for (int j = 0; j < n; j++) cin >> p[i][j];
// 	}
// 	cout << construct(p);
// }	

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:65:8: error: could not convert '(int (*)[1005])(& b)' from 'int (*)[1005]' to 'std::vector<std::vector<int> >'
   65 |  build(b);
      |        ^
      |        |
      |        int (*)[1005]