제출 #1207783

#제출 시각아이디문제언어결과실행 시간메모리
1207783tamzid슈퍼트리 잇기 (IOI20_supertrees)C++20
컴파일 에러
0 ms0 KiB
#include "supertrees.h"
#include <vector>
using namespace std;

int construct(std::vector<std::vector<int>> p) {
	
	int n = p.size();

	if(n == 1)
	{
		build({{0}});
		return 1;
	}

	vector<vector<int>> a(n,vector<int>(n,0));

	for(int i=0;i<n;++i)
	{
		a[i-1][i] = 1;
		a[i][i-1] = 1;
	}

	build(a);

	return 1;
}
#include "supertrees.h"
#include <vector>
using namespace std;

int construct(std::vector<std::vector<int>> p) {
	
	int n = p.size();

	if(n == 1)
	{
		build({{0}});
		return 1;
	}

	vector<vector<int>> a(n,vector<int>(n,0));

	for(int i=1;i<n;++i)
	{
		a[0][i] = 1;
		a[i][0] = 1;
	}

	for(int i=0;i<n;++i)
	{
		for(int j=0;j<n;++j)
		{
			if(p[i][j] != a[i][j])
			{
				a[i][j] = p[i][j];
			}
		}
	}

	build(a);

	return 1;
}

컴파일 시 표준 에러 (stderr) 메시지

supertrees.cpp:31:5: error: redefinition of 'int construct(std::vector<std::vector<int> >)'
   31 | int construct(std::vector<std::vector<int>> p) {
      |     ^~~~~~~~~
supertrees.cpp:5:5: note: 'int construct(std::vector<std::vector<int> >)' previously defined here
    5 | int construct(std::vector<std::vector<int>> p) {
      |     ^~~~~~~~~