# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
44100 | dhkim0225 | 비교 (balkan11_cmp) | C++14 | 2460 ms | 94328 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cmp.h"
int bases[4] = { 12, 10, 8, 6 };
void remember(int n) {
for (int i = 4; i >= 1; i--) {
int base = bases[i - 1];
if (n >= base) {
int r = n % base;
n /= base;
bit_set(i * 1000 + r);
}
else if (n == 0)
bit_set(i * 1000);
else {
bit_set(i * 1000 + n);
n = 0;
}
}
}
int compare(int b) {
int converted[5] = { 0, };
for (int i = 4; i >= 1; i--) {
int base = bases[i - 1];
if (b >= base) {
converted[i] = (b % base);
b /= base;
}
else {
converted[i] = b;
break;
}
}
for (int i = 1; i <= 4; i++) {
int base = bases[i - 1];
if (bit_get(1000 * i + converted[i]))
continue;
else {
if (converted[i] >= base/2) {
for (int j = converted[i] + 1; j < base; j++) {
if (bit_get(1000 * i + j))
return -1;
}
return 1;
}
else {
for (int j = converted[i] - 1; j >= 0; j--) {
if (bit_get(1000 * i + j))
return 1;
}
return -1;
}
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |