Submission #26713

#TimeUsernameProblemLanguageResultExecution timeMemory
26713grandsQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
60 / 100
1882 ms25672 KiB
#define B(x,h) (x&(1 << h)) int encode(int n, int x, int y) { int h = 0, cntx = 0, cnty = 0; while (h != 10){ bool X = B(x, h); bool Y = B(y, h); h++; cntx += X; cnty += Y; if (X > Y){ return h; } } h = 0; while (h != 5){ bool X = B(cntx, h); bool Y = B(cnty, h); h++; if (X < Y){ return 10 + h; } } }
int decode(int n, int q, int h) { if (h <= 10){ h -= 1; bool Q = (q&(1 << h)); return Q; } else{ int i = h - 11, cntq = 0; h = 0; while (h != 10){ bool Q = (q&(1 << h)); h++; cntq += Q; } bool Q = (cntq&(1 << i)); return !Q; } }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...