Submission #4696

# Submission time Handle Problem Language Result Execution time Memory
4696 2013-12-19T02:52:05 Z cki86201 cmp (balkan11_cmp) C++
100 / 100
2225 ms 96084 KB
#include"cmp.h"
void remember(int n){
	n+=1365;
	while(n){
		bit_set(n);
		n=(n-1)/4;
	}
}

int compare(int b) {
	int t[7],i;
	b+=1365;
	for(i=1;i<=6;i++)t[i]=b,b=(b-1)/4;
	int st=1,en=6,mi,lca=0;
	while(st<=en){
		mi=(st+en)>>1;
		if(!bit_get(t[mi]))st=mi+1,lca=mi;
		else en=mi-1;
	}
	if(lca==0)return 0;
	int a=(t[lca]-1)%4;
	if(a==3)return 1;
	if(a==2)return bit_get(t[lca]+1)?-1:1;
	if(a==1)return bit_get(t[lca]-1)?1:-1;
	if(a==0)return -1;
	return bit_get(13);
}
# Verdict Execution time Memory Grader output
1 Correct 2225 ms 96084 KB Output is correct - maxAccess = 10, score = 100