Submission #329565

#TimeUsernameProblemLanguageResultExecution timeMemory
329565pggpConnecting Supertrees (IOI20_supertrees)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "supertrees.h"

using namespace std;

vector< vector < int > > comp;
int comp_id[1005];

//void build(vector< vector < int > > p){
//	}

int construct(vector< vector < int > > p){
	int n = p.size();
	for (int i = 0; i < n; ++i)
	{
		bool added = false;
		// sprawdzamy do której składowej należy i
		for(int j = 0; j < comp.size(); j++){
			if(p[i][comp[j][0]] != 0){
				comp[j].push_back(i);
				comp_id[i] = j;
				added = true;
				break;
			}
		}
		if(!added){
			vector < int > v;
			v.push_back(i);
			comp_id[i] = comp.size();
			comp.push_back(v);
		}
	}


	vector < vector < int > > b;
	b.resize(n);
	for (int i = 0; i < n; ++i)
	{
		b[i].resize(n);
		for (int j = 0; j < n; ++j)
		{
			b[i][j] = 0;
		}
	}

	for(int	i = 0; i < comp.size(); i++){
		for (int j = 1; j < comp[i].size(); ++j)
		{
			b[comp[i][j]][comp[i][j - 1]] = 1;
			b[comp[i][j - 1]][comp[i][j]] = 1;
		}
	}
	build(b);
	return 1;
}

int main(){

}

Compilation message (stderr)

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:18:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for(int j = 0; j < comp.size(); j++){
      |                  ~~^~~~~~~~~~~~~
supertrees.cpp:46:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |  for(int i = 0; i < comp.size(); i++){
      |                 ~~^~~~~~~~~~~~~
supertrees.cpp:47:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |   for (int j = 1; j < comp[i].size(); ++j)
      |                   ~~^~~~~~~~~~~~~~~~
/tmp/cc1tCspO.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccFUfyxt.o:supertrees.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status