Submission #564840

#TimeUsernameProblemLanguageResultExecution timeMemory
564840UzoufQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
0 / 100
1769 ms24012 KiB
int encode(int n,int x,int y) { int a=x,b=y; for (int p=10;p>=0;p--) { int i=0,j=0; if ((1<<p)<=a) { a-=(1<<p); i=1; } if ((1<<p)<=b) { b-=(1<<p); j=1; } if (i>j) return p+1; } a=__builtin_popcount(x); b=__builtin_popcount(y); for (int p=5;p>=0;p--) { int i=0,j=0; if ((1<<p)<=a) { a-=(1<<p); i=1; } if ((1<<p)<=b) { b-=(1<<p); j=1; } if (i<j) return p+11; } }
int decode(int n,int q,int h) { h--; if (h>=10) { h-=10; int nm=__builtin_popcount(q); int k=nm; for (int p=5;p>=0;p--) { int i=0; if ((1<<p)<=k) { k-=(1<<p); i=1; } if (p==h) { if (i==1) return 1; else return 0; } } } else { int k=q; for (int p=10;p>=0;p--) { int i=0; if ((1<<p)<=k) { k-=(1<<p); i=1; } if (p==h) { if (i==0) return 1; else return 0; } } } }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:26:2: warning: control reaches end of non-void function [-Wreturn-type]
   26 |  }
      |  ^

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