Submission #108741

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1087412019-05-01 08:10:32tjd2291-Color Coloring (FXCUP2_coloring)C++14
1 / 1
3 ms384 KiB
#include "coloring.h"
#include <vector>
using namespace std;
bool in[101];
vector<int> v1, v2;
int paint = 0;
int find(int back, int &coin) {
if (v1.size() == 1 && v2.empty()) return v1[0];
else if (v2.size() == 1 && v1.empty()) return v2[0];
if (!coin) return -1;
for (auto x : v1) Color(x), ++paint;
int c = GetColor(back); --coin;
vector<int> *live = &v1, *erase = &v2;
if (c) live = &v2, erase = &v1;
erase->clear();
while (live->size() > erase->size()) {
erase->push_back(live->back());
live->pop_back();
}
return find(back, coin);
}
void ColoringSame(int N) {
int i;
int coin = 200;
vector<int> stk, v;
stk.push_back(1);
while (coin>6 && stk.size()!=N) { // N cond
int t = 1;
v1.clear(); v2.clear();
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

coloring.cpp: In function 'void ColoringSame(int)':
coloring.cpp:28:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (coin>6 && stk.size()!=N) { // N cond
                   ~~~~~~~~~~^~~
coloring.cpp:47:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < v.size() && paint+stk.size()<7300; ++i) {
              ~~^~~~~~~~~~
coloring.cpp:50:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < v.size() && paint + stk.size() < 7300; ++j)
                   ~~^~~~~~~~~~
coloring.cpp:46:6: warning: unused variable 'pad' [-Wunused-variable]
  int pad = 0;
      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...