Submission #189118

# Submission time Handle Problem Language Result Execution time Memory
189118 2020-01-13T19:27:50 Z TadijaSebez Question (Grader is different from the original contest) (CEOI14_question_grader) C++11
60 / 100
1620 ms 80304 KB
int encode (int n, int x, int y) {
	for(int i=0;i<10;i++)
	{
		if((x>>i&1) && !(y>>i&1)) return i+1;
	}
	int sum1=0,sum2=0;
	for(int i=0;i<10;i++) sum1+=x>>i&1,sum2+=y>>i&1;
	sum1--;sum2--;
	for(int i=0;i<4;i++)
	{
		if(!(sum1>>i&1) && (sum2>>i&1)) return 11+i;
	}
}
int decode (int n, int q, int h) {
	if(h<=10)
	{
		h--;
		if(q>>h&1) return 1;
		else return 0;
	}
	else
	{
		h-=11;
		int sum=0;
		for(int i=0;i<10;i++) sum+=q>>i&1;
		sum--;
		if(!(sum>>h&1)) return 1;
		else return 0;
	}
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:13:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Partially correct 1620 ms 80304 KB Output is partially correct - maxh = 14
2 Partially correct 1613 ms 80056 KB Output is partially correct - maxh = 14