# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
899454 | rajkon | 비교 (balkan11_cmp) | C++14 | 1300 ms | 107136 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cmp.h"
#include <iostream>
int offset[6] {1, 4097, 5121, 5377, 5441, 5457};
void remember(int n) {
for (int i = 0; i < 6; i++) {
int address = (n >> 2*i) + offset[i];
bit_set(address);
}
}
int compare(int b) {
int L = 0, R = 6;
while (L + 1 < R) {
int m = (L + R) / 2;
int address = (b >> 2*m) + offset[m];
if (bit_get(address)) R = m;
else L = m;
}
if (L == 0) {
if (bit_get(b + 1)) return 0;
}
int last_d = 3 & (b >> (2*L));
int prefix = (b >> (2*(L+1))) << 2;
if (last_d == 0) return -1;
if (last_d == 3) return 1;
else if (last_d == 1) {
if (bit_get(prefix + offset[L])) return 1;
else return -1;
} else {
if (bit_get(prefix+3 + offset[L])) return -1;
else return 1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |