Submission #1141757

#TimeUsernameProblemLanguageResultExecution timeMemory
1141757mohyaycmp (balkan11_cmp)C++20
0 / 100
445 ms82628 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 (n > 0) {
            if (n >= j) {
                n -= j;
                bit_set(i);
            }
            j/=2;
            i--;
        }
    }
    else {
        bit_set(100);
        ll j = 2048;
        ll i = 12;
        while (n > 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 (n > 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 (n > 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)

cmp.cpp: In function 'int compare(int)':
cmp.cpp:74:1: warning: control reaches end of non-void function [-Wreturn-type]
   74 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...