# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1247373 | MateiKing80 | cmp (balkan11_cmp) | C++20 | 2477 ms | 102332 KiB |
#include "cmp.h"
#include <bits/stdc++.h>
using namespace std;
int gib(int x, int bit) {
if (x & (1 << bit))
return 1;
return 0;
}
void remember(int a) {
a += 1 << 12;
while (a > 1) {
bit_set(a);
a = a / 4;
}
}
int compare(int b) {
b += 1 << 12;
vector<int> nrs;
while (b > 1) {
nrs.push_back(b);
b = b / 4;
}
int pos = -1;
for (int pas = 16; pas; pas >>= 1)
if (pos + pas < (int)nrs.size() && !bit_get(nrs[pos + pas]))
pos += pas;
if (pos == -1)
return 0;
b = nrs[pos];
int x = (b / 4) * 4;
if (b == x)
return -1;
if (b == x + 1)
return bit_get(x) ? 1 : -1;
if (b == x + 2)
return bit_get(x + 3) ? -1 : 1;
if (b == x + 3)
return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |