# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
338907 | Berted | 비교 (balkan11_cmp) | C++14 | 2513 ms | 102324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cmp.h"
#include <iostream>
using namespace std;
int B[6] = {};
void remember(int n)
{
//cerr << "Initializing: " << n << "\n";
for (int i = 5; i >= 0; i--) {B[i] = n & 3; n >>= 2;}
B[0] ^= 4;
for (int i = 1; i < 6; i++) {B[i] ^= (B[i - 1] << 2);}
for (int i = 0; i < 6; i++)
{
//cerr << "Toggling: " << B[i] << "\n";
bit_set(B[i]);
}
}
int compare(int b)
{
for (int i = 5; i >= 0; i--) {B[i] = b & 3; b >>= 2;}
B[0] ^= 4;
for (int i = 1; i < 6; i++) {B[i] ^= (B[i - 1] << 2);}
int L = 0, R = 6;
while (L < R)
{
int M = L + R >> 1;
if (bit_get(B[M])) {L = M + 1;}
else {R = M;}
}
//cerr << "L = " << L << "\n";
if (L == 6) return 0;
int pref = (L) ? (B[L - 1] << 2) : 4;
if ((B[L] & 3) == 0) {return -1;}
else if ((B[L] & 3) == 1) {return (bit_get(pref)) ? 1 : -1;}
else if ((B[L] & 3) == 2) {return (bit_get((pref ^ 3))) ? -1 : 1;}
else {return 1;}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |