Submission #36414

#TimeUsernameProblemLanguageResultExecution timeMemory
36414bnahmad15Question (Grader is different from the original contest) (CEOI14_question_grader)C++14
0 / 100
1269 ms27472 KiB
#include <bits/stdc++.h> int encode(int n,int x,int y){ int bit = 0; for (int i= 0;i<10;i++){ if ((x&(1<<i)) != (y&(1<<i))){ bit = i; if (x & (1<<i) == 1) bit+=10; break; } } return bit+1; }
#include <bits/stdc++.h> int decode(int n,int q,int h){ h--; if (h >= 10) return (q & (1 << (h-10)) == 1) ? 1 : 0; else return (q & (1 << h) == 0) ? 1 : 0; }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:7:24: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
         if (x & (1<<i) == 1)
                        ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:5:32: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
      return (q & (1 << (h-10)) == 1) ? 1 : 0;
                                ^
decoder.cpp:7:29: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
        return (q & (1 << h) == 0) ? 1 : 0;
                             ^
#Verdict Execution timeMemoryGrader output
Fetching results...