# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
108697 | 2019-05-01T05:09:14 Z | tjd229 | 1-Color Coloring (FXCUP2_coloring) | C++14 | 2 ms | 384 KB |
#include <stdio.h> #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 && stk.size()!=N) { 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(back)) 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 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 | 384 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 256 KB | Output is correct |
13 | Runtime error | 2 ms | 384 KB | Execution failed because the return code was nonzero |
14 | Halted | 0 ms | 0 KB | - |