Submission #793605

# Submission time Handle Problem Language Result Execution time Memory
793605 2023-07-26T04:34:23 Z khshg cmp (balkan11_cmp) C++14
0 / 100
671 ms 96032 KB
#include "cmp.h"
#include<bits/stdc++.h>
using namespace std;

const int arr[] = {1, 1 + 4, 1 + 4 + 4 * 4, 1 + 4 + 4 * 4 + 4 * 4 * 4, 1 + 4 + 4 * 4 + 4 * 4 * 4 + 4 * 4 * 4 * 4, 1 + 4 + 4 * 4 + 4 * 4 * 4 + 4 * 4 * 4 * 4 + 4 * 4 * 4 * 4 * 4};

void remember(int a) {
	for(int i = 0; i < 6; ++i) {
		bit_set(arr[i] + (a >> (10 - 2 * i)));
	}
}

int compare(int b) {
	int tl = 0, tr = 6;
	while(tl < tr) {
		int tm = (tl + tr) / 2;
		if(bit_get(arr[tm] + (b >> (10 - 2 * tm)))) {
			tl = tm + 1;
		} else {
			tr = tm;
		}
	}
	if(tl == 6) return 0;
	b >>= (10 - 2 * tl);
	int t = b;
	b &= 3;
	t -= b;
	if(b == 3) return 1;
	if(b == 0) return -1;
	if(b == 1) bit_get(arr[tl] + t) ? 1 : -1;
	return bit_get(arr[tl] + t + 3) ? -1 : 1;
}

Compilation message

cmp.cpp: In function 'int compare(int)':
cmp.cpp:30:42: warning: second operand of conditional expression has no effect [-Wunused-value]
   30 |  if(b == 1) bit_get(arr[tl] + t) ? 1 : -1;
      |                                          ^
cmp.cpp:30:42: warning: third operand of conditional expression has no effect [-Wunused-value]
# Verdict Execution time Memory Grader output
1 Incorrect 671 ms 96032 KB ZERO POINTS: For a=3069 and b=1532, correct answer is -1, got 1