Submission #17510

# Submission time Handle Problem Language Result Execution time Memory
17510 2015-12-24T02:49:32 Z gs14004 cmp (balkan11_cmp) C++14
Compilation error
0 ms 0 KB
#include "cmp.h"
#include <vector>
using namespace std;

void remember(int n) {
	n += 4096;
	while(n){
		bit_set(n);
		n >>= 1;
	}
}

int compare(int b) {
	b += 4096;
	if(bit_get(b)) return 0;
	vector<int> v;
	while(b){
		v.push_back(b);
		b >>= 1;
	}
	reverse(v.begin(), v.end());
	int s = 0, e = v.size() - 2;
	while(s != e){
		int m = (s+e)/2;
		if(!bit_get(v[m])) e = m;
		else s = m+1;
	}
	if(v[s]%2) return 1;
	return -1;
}

Compilation message

cmp.cpp: In function 'int compare(int)':
cmp.cpp:21:2: error: 'reverse' was not declared in this scope
  reverse(v.begin(), v.end());
  ^~~~~~~
cmp.cpp:21:2: note: suggested alternative: 'remember'
  reverse(v.begin(), v.end());
  ^~~~~~~
  remember