# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
36524 | cheater2k | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++14 | 1816 ms | 27480 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 <bits/stdc++.h>
using namespace std;
namespace A {
int mp[960];
bool called; // check whether function build() was called
// map i (1 <= i <= 920) with a 12-bit integer j such that __builtin_popcount(j) = 6
void build() {
int cur = 0;
for (int mask = 0; mask < (1 << 12); ++mask) {
if (__builtin_popcount(mask) == 6) {
mp[++cur] = mask;
}
}
}
};
int encode (int n, int x, int y) {
if (!A::called) A::called = true, A::build();
int X = A::mp[x], Y = A::mp[y];
for (int i = 0; i < 12; ++i) {
int bitX = (X >> i & 1);
int bitY = (Y >> i & 1);
if (!bitX && bitY) {
// the i-th bit of X is 0 while that of Y is 1
return i + 1;
}
}
}
#include <bits/stdc++.h>
using namespace std;
namespace B { // similar to namespace A
int mp[960];
bool called; // check whether function build() was called
// map i (1 <= i <= 920) with a 12-bit integer j such that __builtin_popcount(j) = 6
void build() {
int cur = 0;
for (int mask = 0; mask < (1 << 12); ++mask) {
if (__builtin_popcount(mask) == 6) {
mp[++cur] = mask;
}
}
}
};
int decode (int n, int q, int h) { // X and Y is different at h-th bit
if (!B::called) B::called = true, B::build();
int Q = B::mp[q];
--h;
int bitQ = Q >> h & 1;
if (!bitQ) return true; else return false;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |