Submission #108693

#TimeUsernameProblemLanguageResultExecution timeMemory
108693tjd2291-Color Coloring (FXCUP2_coloring)C++14
0 / 1
4 ms384 KiB
#include "coloring.h" #include <vector> using namespace std; int in[101]; void ColoringSame(int N){ int i,j,coin=200; int pad[7] = { 0 }; vector<int> bit_vec[7],stk,v; for (i = 2; i <= N; ++i) { for (int j = 0, n = i; j < 7; ++j) { if (n & 1) bit_vec[j].push_back(i); n >>= 1; } } stk.push_back(1); while (coin) { int nxt = 0; int back = stk.back(); for (j = 0; j < 7 && coin; ++j) { if (bit_vec[j].size() - pad[j]) { for (auto x : bit_vec[j]) if(!in[x]) Color(x); } if (!GetColor(1)) nxt |= (1 << j); --coin; } if (j > 7) { stk.push_back(nxt); in[nxt] = 1; for (j = 0; j < 7; ++j) { if (nxt & 1) ++pad[j]; nxt >>= 1; } } } Color(1); for (i = 2; i <= N; ++i) if (!in[i]) v.push_back(i); for (i = 0; i < v.size(); ++i) for (j = 0; j < v.size(); ++j) Color(v[j]); for (; stk.size() > 1; stk.pop_back()) Color(stk.back()); }

Compilation message (stderr)

coloring.cpp: In function 'void ColoringSame(int)':
coloring.cpp:18:7: warning: unused variable 'back' [-Wunused-variable]
   int back = stk.back();
       ^~~~
coloring.cpp:37:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < v.size(); ++i) for (j = 0; j < v.size(); ++j) Color(v[j]);
              ~~^~~~~~~~~~
coloring.cpp:37:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < v.size(); ++i) for (j = 0; j < v.size(); ++j) Color(v[j]);
                                             ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...