# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1141797 | mohyay | cmp (balkan11_cmp) | C++20 | 993 ms | 82628 KiB |
#include "cmp.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
using ll = long long;
#define pb push_back
#define pF first
#define pS second
#define SP <<' '<<
void remember(int a) {
unsigned int n = a;
if (popcount(n) <= 6) {
ll j = 2048;
ll i = 12;
while (i > 0) {
if (n >= j) {
n -= j;
bit_set(i);
}
j/=2;
i--;
}
}
else {
bit_set(100);
ll j = 2048;
ll i = 12;
while (i > 0) {
if (n >= j) {
n -= j;
}
else bit_set(i);
j/=2;
i--;
}
}
}
int compare(int b) {
ll n = b;
ll neg = bit_get(100);
ll cmp1 = 1;
if (neg == 0) {
ll j = 2048;
ll i = 12;
while (i > 0) {
ll x = bit_get(i);
if (n >= j) {
n -= j;
if (x == 0) {cmp1 = 0; break;}
}
else if (x == 1) {cmp1 = 2; break;}
j /= 2;
i--;
}
}
else {
ll j = 2048;
ll i = 12;
while (i > 0) {
ll x = bit_get(i);
if (n >= j) {
n -= j;
if (x == 1) {cmp1 = 0; break;}
}
else if (x == 0) {cmp1 = 2; break;}
j /= 2;
i--;
}
}
if (cmp1 == 2) return -1;
if (cmp1 == 1) return 0;
if (cmp1 == 0) return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |