# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
108693 | tjd229 | 1-Color Coloring (FXCUP2_coloring) | C++14 | 4 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |