Submission #317125

#TimeUsernameProblemLanguageResultExecution timeMemory
317125amunduzbaevConnecting Supertrees (IOI20_supertrees)C++14
Compilation error
0 ms0 KiB
#include "grader.cpp"
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;


int construct(vector<vector<int>> p) {
	int n = p.size();
	vector<vector<int> > b(n);
	bool ok1=0, ok2=0, ok0=0;
	for(int i=0;i<n;i++){
		b[i].resize(n);
		for(int j=0;j<n;j++){
			b[i][j]=0;
			if(p[i][j] == 1) ok1=1;
			else if(p[i][j] == 2) ok2=1;
			else ok0 = 1;
		}
	}
	//cout<<ok1<<" "<<ok2<<" "<<ok0<<"\n";
	if(ok1 && !ok2 && !ok0){
		for(int i=1;i<n;i++){
			b[i-1][i] = 1;
			b[i][i-1] = 1;
		}
		build(b);
		return 1;
	}
	/*
	else if(ok1 && ok0 && !ok2){
		int start;
		vector<int> v;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(p[i][j] == 1){
					v.push_back(i);
					v.push_back(j);
				}
			}
		}
		start = v[0];
		for(auto x:v){
			b[start][x] = 1;
			b[x][start] = 1;
		}
		build(b);
		return 1;
	}
	else if(ok2&&ok0&&!ok1){
		int start;
		vector<int> v;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(p[i][j] == 2){
					v.push_back(i);
					v.push_back(j);
				}
			}
		}
		start = v[0];
		for(auto x:v){
			b[start][x] = 1;
			b[x][start] = 1;
		}
		b[v[v.size()-1]][start] = 1;
		b[start][v[v.size()-1]] = 1;
		build(b);
		return 1;
	}
	*/
	return 0;
}

/*

4
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1

*/

Compilation message (stderr)

/tmp/ccDiaJwf.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cclL8jOi.o:supertrees.cpp:(.text.startup+0x0): first defined here
/tmp/ccDiaJwf.o: In function `build(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)':
grader.cpp:(.text+0x1d0): multiple definition of `build(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
/tmp/cclL8jOi.o:supertrees.cpp:(.text+0x1d0): first defined here
collect2: error: ld returned 1 exit status