# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1247368 | MateiKing80 | cmp (balkan11_cmp) | C++20 | 628 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;
}
const int bulan = 4096;
void remember(int a) {
a += bulan;
while (a) {
bit_set(a);
a = a / 4;
}
}
int compare(int b) {
b += bulan;
vector<int> nrs;
while (b) {
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 + 1;
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... |