Submission #451546

# Submission time Handle Problem Language Result Execution time Memory
451546 2021-08-03T08:40:33 Z kingfran1907 Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
27 / 100
4242 ms 24196 KB
int encode (int n, int x, int y) {
	for (int i = 0; i < 20; i++) {
		if ((x & (1 << i)) != (y & (1 << i))) {
			if (x & (1 << i)) return 2 * i + 2;
			else return 2 * i + 1;
		}
	}
}
int decode (int n, int q, int h) {
	h -= 1;
	int dig = h / 2;
	int ac = h % 2;
	
	if ((q & (1 << dig)) == (ac << dig)) return 1;
	else return 0;
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:8:1: warning: control reaches end of non-void function [-Wreturn-type]
    8 | }
      | ^
# Verdict Execution time Memory Grader output
1 Partially correct 4047 ms 24104 KB Output is partially correct - maxh = 20
2 Partially correct 4242 ms 24196 KB Output is partially correct - maxh = 20