# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
568833 | Jomnoi | cmp (balkan11_cmp) | C++17 | 0 ms | 208 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 <bits/stdc++.h>
#include "cmp.h"
using namespace std;
void remember(int n) {
vector <int> digits;
while(n > 0) {
digits.push_back(n % 4);
n /= 4;
}
while(digits.size() < 6) {
digits.push_back(0);
}
reverse(digits.begin(), digits.end());
int base4 = 0;
for(int i = 0; i < 6; i++) {
base4 *= 4;
base4 += digits[i];
bit_set(base4);
}
}
int compare(int b) {
vector <int> digits;
while(b > 0) {
digits.push_back(b % 4);
b /= 4;
}
while(digits.size() < 6) {
digits.push_back(0);
}
reverse(digits.begin(), digits.end());
int base4;
int l = 0, r = 6;
while(l < r) {
int mid = (l + r) / 2;
base4 = 0;
for(int i = 0; i < mid; i++) {
base4 *= 4;
base4 += digits[i];
}
if(bit_get(base4)) {
l = mid;
}
else {
r = mid - 1;
}
}
if(l == 6) {
return 0;
}
base4 = 0;
for(int i = 0; i < l; i++) {
base4 *= 4;
base4 += digits[i];
}
if(digits[l] >= 2) {
base4 *= 4;
base4 += 3;
if(bit_get(base4)) {
return -1;
}
return 1;
}
else {
base4 *= 4;
if(bit_get(base4)) {
return 1;
}
return -1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |