Submission #17406

# Submission time Handle Problem Language Result Execution time Memory
17406 2015-11-27T18:59:34 Z eaststar Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
100 / 100
1568 ms 25684 KB
int A[930];
bool initchk=true;
void init(){
    int i,j=1;
    initchk=false;
    for(i=63;i<4096;++i){
        int cnt=__builtin_popcount(i);
        if(cnt==6)A[j++]=i;
    }
}
int encode(int N,int x,int y){
	if(initchk)init();
	x=A[x],y=A[y];
	return __builtin_ffs(x&(x^y));
}
int A[930];
bool initchk=true;
void init(){
    int i,j=1;
    initchk=false;
    for(i=63;i<4096;++i){
        int cnt=__builtin_popcount(i);
        if(cnt==6)A[j++]=i;
    }
}
int decode(int N,int q,int h){
  	if(initchk)init();
	q=A[q];
	return (q&(1<<(h-1)))>0;
}
# Verdict Execution time Memory Grader output
1 Correct 1542 ms 25684 KB Output is correct - maxh = 12
2 Correct 1568 ms 25684 KB Output is correct - maxh = 12