#include <bits/stdc++.h>
#include "cmp.h"
using namespace std;
// void bit_set(int add)
// int bit_get(int add);
void remember(int a){
for(int i = 0; i < 6; i++){
int x = 4 * i;
bit_set(a / x * x + 1);
}
}
int compare(int b){
int l = 0, r = 5, res = -1;
while(l <= r){
int mid = (l + r) / 2;
int x = 4 * mid;
if(bit_get(b / x * x + 1) == 0){
l = mid + 1;
res = mid;
}
else{
r = mid - 1;
}
}
if(res == -1){
return 0;
}
// int dig = (b >> (res * 2));
int dig = b / (res * 4) * (res * 4) + 1;
if(dig % 4 == 3){
return 1;
}
if(dig % 4 == 2){
int x = bit_get(dig + 3);
return x == 1 ? -1 : 1;
}
if(dig % 4 == 1){
int x = bit_get(dig);
return x == 1 ? 1 : -1;
}
if(dig % 4 == 0){
return -1;
}
return 0;
}
// by me
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
4696 KB |
Execution killed with signal 8 |