Submission #668509

#TimeUsernameProblemLanguageResultExecution timeMemory
668509RambaXGorillaQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
0 / 100
7051 ms6116 KiB
using namespace std; int encode(int N, int X, int Y){ int x, y; for(int i = 0, j = 0;i < 1 << 12;i++){ if(__builtin_popcount(i) == 6){ j++; if(j > X && j > Y) break; else if(j == X) x = i; else if(j == Y) y = i; } } return __builtin_ctz(x ^ (x & y)) + 1; } int decode(int N, int Q, int H){ int q; for(int i = 0, j = 0;i < 1 << 12;i++){ if(__builtin_popcount(i) == 6){ j++; if(j > Q) break; else if(j == Q) q = i; } } return (bool) (q & 1 << H - 1); }
using namespace std; int encode(int N, int X, int Y){ int x, y; for(int i = 0, j = 0;i < 1 << 12;i++){ if(__builtin_popcount(i) == 6){ j++; if(j > X && j > Y) break; else if(j == X) x = i; else if(j == Y) y = i; } } return __builtin_ctz(x ^ (x & y)) + 1; } int decode(int N, int Q, int H){ int q; for(int i = 0, j = 0;i < 1 << 12;i++){ if(__builtin_popcount(i) == 6){ j++; if(j > Q) break; else if(j == Q) q = i; } } return (bool) (q & 1 << H - 1); }

Compilation message (stderr)

encoder.cpp: In function 'int decode(int, int, int)':
encoder.cpp:25:31: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   25 |     return (bool) (q & 1 << H - 1);
      |                             ~~^~~
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:13:28: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 |     return __builtin_ctz(x ^ (x & y)) + 1;
      |                          ~~^~~~~~~~~
encoder.cpp:13:28: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
encoder.cpp: In function 'int decode(int, int, int)':
encoder.cpp:25:12: warning: 'q' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |     return (bool) (q & 1 << H - 1);
      |            ^~~~~~~~~~~~~~~~~~~~~~~

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:25:31: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   25 |     return (bool) (q & 1 << H - 1);
      |                             ~~^~~
decoder.cpp: In function 'int encode(int, int, int)':
decoder.cpp:13:28: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 |     return __builtin_ctz(x ^ (x & y)) + 1;
      |                          ~~^~~~~~~~~
decoder.cpp:13:28: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:25:12: warning: 'q' may be used uninitialized in this function [-Wmaybe-uninitialized]
   25 |     return (bool) (q & 1 << H - 1);
      |            ^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...