Submission #603471

#TimeUsernameProblemLanguageResultExecution timeMemory
603471CyberCowConnecting Supertrees (IOI20_supertrees)C++17
11 / 100
227 ms22136 KiB
#include "supertrees.h"
#include <vector>
using namespace std;

int construct(vector<std::vector<int>> p) {
	int n = p.size();
	vector<std::vector<int>> ans(n);
	int st1 = 0, st2 = 0, st0 = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < p[i].size(); j++)
		{
			if (p[i][j] == 1)
				st1 = 1;
			else if (p[i][j] == 2)
				st2 = 1;
			else
				st0 = 1;
		}
	}
	if (st1 == 1 && st2 == 0 && st0 == 0)
	{
		ans[0].push_back(0);
		for (int i = 1; i < n; i++)
		{
			ans[0].push_back(1);
		}
		for (int i = 1; i < n; i++)
		{
			ans[i].push_back(1);
			for (int j = 1; j < n; j++)
			{
				ans[i].push_back(0);
			}
		}
	}
	build(ans);
	return 1;
}

Compilation message (stderr)

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:11:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |   for (int j = 0; j < p[i].size(); j++)
      |                   ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...