# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1141774 | mohyay | 비교 (balkan11_cmp) | C++20 | 482 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 (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 (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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |