Submission #668515

#TimeUsernameProblemLanguageResultExecution timeMemory
668515RambaXGorillaQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
100 / 100
4149 ms24220 KiB
using namespace std; int conv[930] = {}; void fillConv(){ if(conv[1]) return; for(int i = 0, j = 0;i < 1 << 12;i++){ if(__builtin_popcount(i) == 6){ j++; conv[j] = i; } } } int encode(int N, int X, int Y){ fillConv(); return __builtin_ctz(conv[X] ^ (conv[X] & conv[Y])) + 1; } int decode(int N, int Q, int H){ fillConv(); return (bool) (conv[Q] & 1 << H - 1); }
using namespace std; int conv[930] = {}; void fillConv(){ if(conv[1]) return; for(int i = 0, j = 0;i < 1 << 12;i++){ if(__builtin_popcount(i) == 6){ j++; conv[j] = i; } } } int encode(int N, int X, int Y){ fillConv(); return __builtin_ctz(conv[X] ^ (conv[X] & conv[Y])) + 1; } int decode(int N, int Q, int H){ fillConv(); return (bool) (conv[Q] & 1 << H - 1); }

Compilation message (stderr)

encoder.cpp: In function 'int decode(int, int, int)':
encoder.cpp:20:37: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   20 |     return (bool) (conv[Q] & 1 << H - 1);
      |                                   ~~^~~

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:20:37: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   20 |     return (bool) (conv[Q] & 1 << H - 1);
      |                                   ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...