답안 #28491

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28491 2017-07-16T06:36:16 Z 三( ε:)(#1146, xdoju, veckal, unused) 1-Color Coloring (FXCUP2_coloring) C++14
1 / 1
0 ms 2028 KB
#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

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++)
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2028 KB Output is correct
2 Correct 0 ms 2028 KB Output is correct
3 Correct 0 ms 2028 KB Output is correct
4 Correct 0 ms 2028 KB Output is correct
5 Correct 0 ms 2028 KB Output is correct
6 Correct 0 ms 2028 KB Output is correct
7 Correct 0 ms 2028 KB Output is correct
8 Correct 0 ms 2028 KB Output is correct
9 Correct 0 ms 2028 KB Output is correct
10 Correct 0 ms 2028 KB Output is correct
11 Correct 0 ms 2028 KB Output is correct
12 Correct 0 ms 2028 KB Output is correct
13 Correct 0 ms 2028 KB Output is correct
14 Correct 0 ms 2028 KB Output is correct
15 Correct 0 ms 2028 KB Output is correct
16 Correct 0 ms 2028 KB Output is correct
17 Correct 0 ms 2028 KB Output is correct
18 Correct 0 ms 2028 KB Output is correct
19 Correct 0 ms 2028 KB Output is correct
20 Correct 0 ms 2028 KB Output is correct
21 Correct 0 ms 2028 KB Output is correct
22 Correct 0 ms 2028 KB Output is correct
23 Correct 0 ms 2028 KB Output is correct
24 Correct 0 ms 2028 KB Output is correct
25 Correct 0 ms 2028 KB Output is correct