Submission #108738

#TimeUsernameProblemLanguageResultExecution timeMemory
108738tjd2291-Color Coloring (FXCUP2_coloring)C++14
0 / 1
3 ms384 KiB
#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 += 1; if (i == 10)pad+=2; for (j = 0; j < v.size()-pad; ++j) Color(v[j]),++paint; } for (; stk.size() > 1; stk.pop_back()) Color(stk.back()); }

Compilation message (stderr)

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) 
               ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...