# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1060955 | thieunguyenhuy | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++17 | 0 ms | 0 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.
vector<int> get_set(int x) {
vector<vector<int>> all_sets;
for (int mask = 0; mask < MASK(12); ++mask) {
if (popcount(mask) != 6) continue;
vector<int> cur_set;
for (int i = 0; i < 12; ++i) if (BIT(mask, i)) {
cur_set.emplace_back(i);
}
sort (cur_set.begin(), cur_set.end());
all_sets.emplace_back(cur_set);
}
sort (all_sets.begin(), all_sets.end());
return all_sets[x - 1];
}
int encoder(int n, int x, int y) {
vector<int> X = get_set(x), Y = get_set(y);
vector<bool> mark(12, false);
for (auto it : Y) mark[it] = true;
for (auto it : X) if (!mark[it]) return it + 1;
assert(false); return -1;
}
vector<int> get_set(int x) {
vector<vector<int>> all_sets;
for (int mask = 0; mask < MASK(12); ++mask) {
if (popcount(mask) != 6) continue;
vector<int> cur_set;
for (int i = 0; i < 12; ++i) if (BIT(mask, i)) {
cur_set.emplace_back(i);
}
sort (cur_set.begin(), cur_set.end());
all_sets.emplace_back(cur_set);
}
sort (all_sets.begin(), all_sets.end());
return all_sets[x - 1];
}
int decode(int n, int q, int h) {
vector<int> Q = get_set(q); --h;
for (auto it : Q) if (it == h) return 1;
return 0;
}