#include<bits/stdc++.h>
#include"cmp.h"
using namespace std;
void remember(int a) {
string s;
s += (a % 2) + '0';
while(a /= 2) s += (a % 2) + '0';
for(int i = 0; i < s.size(); i++) if(s[i] == '1') bit_set(i);
}
int compare(int b) {
string s;
s += (b % 2) + '0';
while(b /= 2) s += (b % 2) + '0';
while(s.size() < 12) s += '0';
reverse(s.begin(), s.end());
for(int i = 0, j = s.size() - 1; i < s.size(); i++, j--) {
bool a = bit_get(j);
if(s[i] == '1' && !a) return 1;
if(s[i] == '0' && a) return -1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |