# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480784 | minhcool | cmp (balkan11_cmp) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cmp.h"
void remember(int n) {
//edit this
set_bit(1 + (n & 7));
set_bit(9 + ((n >> 3) & 7) * 8);
set_bit(81 + ((n >> 6) & 7) * 64);
set_bit(729 + ((n >> 9) & 7) * 512);
}
int compare(int b) {
//edit this
if(!get_bit(1 + (b & 7))){
if((b & 7) >= 4){
for(int i = (b & 7) + 1; i < 8; i++){
if(get_bit(1 + i)){
return -1;
}
}
return 1;
}
else{
for(int i = 0; i < (b & 7); i++){
if(get_bit(1 + i)){
return 1;
}
}
return -1;
}
}
b >>= 3;
if(!get_bit(9 + (b & 7) * 8)){
if((b & 7) >= 4){
for(int i = (b & 7) + 1; i < 8; i++){
if(get_bit(9 + i * 8)){
return -1;
}
}
return 1;
}
else{
for(int i = 0; i < (b & 7); i++){
if(get_bit(9 + i * 8)){
return 1;
}
}
return -1;
}
}
b >>= 3;
if(!get_bit(81 + (b & 7) * 64)){
if((b & 7) >= 4){
for(int i = (b & 7) + 1; i < 8; i++){
if(get_bit(81 + i * 64)){
return -1;
}
}
return 1;
}
else{
for(int i = 0; i < (b & 7); i++){
if(get_bit(81 + i * 64)){
return 1;
}
}
return -1;
}
}
if(!get_bit(729 + (b & 7) * 512)){
if((b & 7) >= 4){
for(int i = (b & 7) + 1; i < 8; i++){
if(get_bit(729 + i * 512)){
return -1;
}
}
return 1;
}
else{
for(int i = 0; i < (b & 7); i++){
if(get_bit(729 + i * 512)){
return 1;
}
}
return -1;
}
}
return 0;
}