Submission #1045178

# Submission time Handle Problem Language Result Execution time Memory
1045178 2024-08-05T18:08:33 Z mariaclara Comparing Plants (IOI20_plants) C++17
Compilation error
0 ms 0 KB
#include "supertrees.h"
#include <vector>
#include<iostream>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int MAXN = 1e5+5;
#define all(x) x.begin()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first 
#define sc second

int construct(vector<vector<int>> p) {
	int n = sz(p);
	vector<int> num_1(n), num_2(n);
	vector<vector<int>> comp_1(n), comp_2(n), ans(n);

	// primeiro monto as árvores
	for(int i = 0; i < n; i++) {
		int add = -1;

		for(int j = 0; j < i; j++) {
			if(p[i][j] != 1) continue;
			if(add == -1) add = num_1[j];
			if(add != num_1[j]) return 0;
		}
		
		if(add == -1) add = i;
		num_1[i] = add;
		comp_1[add].pb(i);
	}

	// monto os ciclos
	for(int i = 0; i < n; i++) {
		int add = -1;

		for(int j = 0; j < i; j++) {
			if(p[i][j] != 2) continue;
			if(add == -1) add = num_2[j];
			if(add != num_2[j]) return 0;
		}

		if(add == -1) add = num_1[i];
		num_2[i] = add;
		if(!comp_1[i].empty()) comp_2[add].pb(i);
	}

	for(int i = 0; i < n; i++) ans[i].resize(n);

	for(int i = 0; i < n; i++) {
		for(int j = 1; j < sz(comp_1[i]); j++) {
			ans[comp_1[i][j-1]][comp_1[i][j]] = 1;
			ans[comp_1[i][j]][comp_1[i][j-1]] = 1;
		}

		for(int j = 1; j < sz(comp_2[i]); j++) {
			ans[comp_2[i][j-1]][comp_2[i][j]] = 1;
			ans[comp_2[i][j]][comp_2[i][j-1]] = 1;
		}

		if(sz(comp_2[i]) <= 1) continue;
		if(sz(comp_2[i]) == 2) return 0;
		ans[comp_2[i].back()][comp_2[i][0]] = 1;
		ans[comp_2[i][0]][comp_2[i].back()] = 1;
	}
	
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < i; j++) {
			int cam = 0;
			if(num_1[i] == num_1[j]) cam = 1;
			else if(num_2[i] == num_2[j]) cam = 2;
			if(p[i][j] != cam) return 0;
		}
	}

	build(ans);
	return 1;
}

Compilation message

plants.cpp:1:10: fatal error: supertrees.h: No such file or directory
    1 | #include "supertrees.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.