Submission #28491

#TimeUsernameProblemLanguageResultExecution timeMemory
28491三( ε:) (#68)1-Color Coloring (FXCUP2_coloring)C++14
1 / 1
0 ms2028 KiB
#include "coloring.h"
#include <bits/stdc++.h>
using namespace std;

void ColoringSame(int N)
{
	vector<int> hubo;
	for (int i = 2; i <= N; i++) hubo.push_back(i);

	int rem = 7300;

	while (hubo.size() > 1)
	{
		for (int j = 0; j < hubo.size() / 2; j++)
		{
			Color(hubo[j]);
			--rem;
		}

		if (GetColor(1) == 1)
		{
			hubo.erase(hubo.begin(), hubo.begin() + hubo.size() / 2);
		}
		else
		{
			hubo.erase(hubo.begin() + hubo.size() / 2, hubo.end());
		}
	}

	int backcolor = hubo[0];
	vector<int> x;

	for (int i = 2; i <= N; i++) if (i != backcolor) x.push_back(i);

	mt19937 mt{ random_device{}() };
	shuffle(x.begin(), x.end(), mt);

	Color(1);
	--rem;

	for (int i = 0; i < rem; i++) Color(x[i % x.size()]);
}

Compilation message (stderr)

coloring.cpp: In function 'void ColoringSame(int)':
coloring.cpp:14:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < hubo.size() / 2; j++)
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...