# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112504 | KCSC | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++14 | 1306 ms | 114552 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;
int codes[925];
void codeGenerator(int N) {
if (codes[1]) {
return; }
int val = 0;
for (int mask = 0; mask < (1 << 12); ++mask) {
if (__builtin_popcount(mask) == 6) {
codes[++val] = mask; } } }
int encode(int N, int X, int Y) {
codeGenerator(N);
for (int i = 0; i < 12; ++i) {
if (((codes[X] >> i) & 1) and !((codes[Y] >> i) & 1)) {
return i + 1; } } }
int decode(int N, int Q, int H) {
codeGenerator(N);
if (codes[Q] & (1 << (H - 1))) {
return 1; }
return 0; }
#ifdef HOME
int main(void) {
freopen("question.in", "r", stdin);
freopen("question.out", "w", stdout);
int T; cin >> T;
while (T--) {
int N, X, Y, Q; cin >> N >> X >> Y >> Q;
cout << decode(N, Q, encode(N, X, Y)) << endl; }
return 0; }
#endif
#include <bits/stdc++.h>
using namespace std;
int codes[925];
void codeGenerator(int N) {
if (codes[1]) {
return; }
int val = 0;
for (int mask = 0; mask < (1 << 12); ++mask) {
if (__builtin_popcount(mask) == 6) {
codes[++val] = mask; } } }
int encode(int N, int X, int Y) {
codeGenerator(N);
for (int i = 0; i < 12; ++i) {
if (((codes[X] >> i) & 1) and !((codes[Y] >> i) & 1)) {
return i + 1; } } }
int decode(int N, int Q, int H) {
codeGenerator(N);
if (codes[Q] & (1 << (H - 1))) {
return 1; }
return 0; }
#ifdef HOME
int main(void) {
freopen("question.in", "r", stdin);
freopen("question.out", "w", stdout);
int T; cin >> T;
while (T--) {
int N, X, Y, Q; cin >> N >> X >> Y >> Q;
cout << decode(N, Q, encode(N, X, Y)) << endl; }
return 0; }
#endif
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |