Submission #28783

# Submission time Handle Problem Language Result Execution time Memory
28783 2017-07-17T07:43:41 Z kriii 1-Color Coloring (FXCUP2_coloring) C++14
1 / 1
0 ms 1176 KB
#include "coloring.h"
#include <vector>
using namespace std;
 
void ColoringSame(int N) {
	vector<int> lf;
	for (int i=2;i<=N;i++) lf.push_back(i);
 
	int last = 1;
	vector<int> see;
	int att = 200;
	for (int k=2;k<N;k++){
		int l = 0, r = lf.size();
		if (att - 7 < 0) break;
		while (l + 1 < r){
			int m = (l + r) / 2;
			att--;
			if (att < 0) break;
			for (int i=l;i<m;i++) Color(lf[i]);
			if (GetColor(last)) l = m;
			else r = m;
		}
		if (att < 0) break;
		see.push_back(lf[l]);
		last = lf[l];
		lf.erase(lf.begin()+l);
	}
 
	Color(1);
	for (int i=0;i<lf.size();i++){
		for (int j=0;j<lf.size();j++) Color(lf[j]);
	}
	while (see.size()>1){
		Color(see.back());
		see.pop_back();
	}
}

Compilation message

coloring.cpp: In function 'void ColoringSame(int)':
coloring.cpp:30:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0;i<lf.size();i++){
                ^
coloring.cpp:31:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j=0;j<lf.size();j++) Color(lf[j]);
                 ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1176 KB Output is correct
2 Correct 0 ms 1176 KB Output is correct
3 Correct 0 ms 1176 KB Output is correct
4 Correct 0 ms 1176 KB Output is correct
5 Correct 0 ms 1176 KB Output is correct
6 Correct 0 ms 1176 KB Output is correct
7 Correct 0 ms 1176 KB Output is correct
8 Correct 0 ms 1176 KB Output is correct
9 Correct 0 ms 1176 KB Output is correct
10 Correct 0 ms 1176 KB Output is correct
11 Correct 0 ms 1176 KB Output is correct
12 Correct 0 ms 1176 KB Output is correct
13 Correct 0 ms 1176 KB Output is correct
14 Correct 0 ms 1176 KB Output is correct
15 Correct 0 ms 1176 KB Output is correct
16 Correct 0 ms 1176 KB Output is correct
17 Correct 0 ms 1176 KB Output is correct
18 Correct 0 ms 1176 KB Output is correct
19 Correct 0 ms 1176 KB Output is correct
20 Correct 0 ms 1176 KB Output is correct
21 Correct 0 ms 1176 KB Output is correct
22 Correct 0 ms 1176 KB Output is correct
23 Correct 0 ms 1176 KB Output is correct
24 Correct 0 ms 1176 KB Output is correct
25 Correct 0 ms 1176 KB Output is correct