답안 #108736

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
108736 2019-05-01T08:00:09 Z tjd229 1-Color Coloring (FXCUP2_coloring) C++14
1 / 1
3 ms 512 KB
#include "coloring.h"
#include <vector>
using namespace std;
int in[101];
void ColoringSame(int N) {
	int i, j;
	int coin = 200;
	vector<int> v, stk;
	int paint = 0;
	for (stk.push_back(1),i = 2; i <= N; ++i) v.push_back(i);
	while ( stk.size()!=N && coin>6) {
		int l = 0, r = v.size()-1;
		while (l < r) {
			int m = (l + r) >> 1;
			int half = (r - l + 1) >> 1;
			for (i = l;half--; ++i) Color(v[i]),++paint;
			--coin;
			if(GetColor(stk.back())) l=i;
			else r = i - 1;
		}
		stk.push_back(v[l]);
		v.erase(v.begin()+l);
	}
	

	int pad = 0;
	for (Color(1), i = 0; i < v.size(); ++i) {
		//if (i == 1) pad += 2;
		//if (i == 10)++pad;
		for (j = 0; j < v.size()-pad; ++j) 
			Color(v[j]),++paint;		
	}
	for (; stk.size() > 1; stk.pop_back()) Color(stk.back());
}

Compilation message

coloring.cpp: In function 'void ColoringSame(int)':
coloring.cpp:11:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while ( stk.size()!=N && coin>6) {
          ~~~~~~~~~~^~~
coloring.cpp:14:8: warning: unused variable 'm' [-Wunused-variable]
    int m = (l + r) >> 1;
        ^
coloring.cpp:27:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (Color(1), i = 0; i < v.size(); ++i) {
                        ~~^~~~~~~~~~
coloring.cpp:30:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (j = 0; j < v.size()-pad; ++j) 
               ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 3 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 3 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 512 KB Output is correct
23 Correct 2 ms 356 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct