Submission #141231

#TimeUsernameProblemLanguageResultExecution timeMemory
141231yys11631Question (Grader is different from the original contest) (CEOI14_question_grader)C++17
0 / 100
7092 ms3056 KiB
int encode(int N, int x, int y) { const int NMAX = 950; const int BMAX = 12; const int MSK = (1 << BMAX) - 1; int v[MSK + 1], l = 0; for (int msk = 0; msk < (1 << BMAX); msk++) { int many = 0; for (int bit = 0; bit < BMAX; bit++) { if (msk&(1 << bit))many++; } if (many == 6)v[l++] = msk; } x--; y--; int X = v[x], Y = v[y] ^ MSK; int H = X & Y; for (int i = 0; i < BMAX; i++) if ((H >> i) & 1) return (i + 1); return -1; }
int decode(int N, int q, int h) { const int NMAX = 950; const int BMAX = 12; const int MSK = (1 << BMAX) - 1; int v[MSK + 1], l = 0; for (int msk = 0; msk < (1 << BMAX); msk++) { int many = 0; for (int bit = 0; bit < BMAX; bit++) { if (msk&(1 << bit))many++; } if (many == 6)v[l++] = msk; } q--; h--; if ((v[q] >> h) & 1)return 1; return 0; }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:3:12: warning: unused variable 'NMAX' [-Wunused-variable]
  const int NMAX = 950;
            ^~~~

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:3:12: warning: unused variable 'NMAX' [-Wunused-variable]
  const int NMAX = 950;
            ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...