# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
338907 | Berted | cmp (balkan11_cmp) | C++14 | 2513 ms | 102324 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"
#include <iostream>
using namespace std;
int B[6] = {};
void remember(int n)
{
//cerr << "Initializing: " << n << "\n";
for (int i = 5; i >= 0; i--) {B[i] = n & 3; n >>= 2;}
B[0] ^= 4;
for (int i = 1; i < 6; i++) {B[i] ^= (B[i - 1] << 2);}
for (int i = 0; i < 6; i++)
{
//cerr << "Toggling: " << B[i] << "\n";
bit_set(B[i]);
}
}
int compare(int b)
{
for (int i = 5; i >= 0; i--) {B[i] = b & 3; b >>= 2;}
B[0] ^= 4;
for (int i = 1; i < 6; i++) {B[i] ^= (B[i - 1] << 2);}
int L = 0, R = 6;
while (L < R)
{
int M = L + R >> 1;
if (bit_get(B[M])) {L = M + 1;}
else {R = M;}
}
//cerr << "L = " << L << "\n";
if (L == 6) return 0;
int pref = (L) ? (B[L - 1] << 2) : 4;
if ((B[L] & 3) == 0) {return -1;}
else if ((B[L] & 3) == 1) {return (bit_get(pref)) ? 1 : -1;}
else if ((B[L] & 3) == 2) {return (bit_get((pref ^ 3))) ? -1 : 1;}
else {return 1;}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |