# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
26787 | grands | 비교 (balkan11_cmp) | C++14 | 892 ms | 82752 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cmp.h"
void remember(int n) {
int front = n >> 6;
int mask = (1 << 6) - 1;
int back = n&mask;
bit_set(front + 1);
int i = 0;
int loc = 10200;
while (i < 6){
bool F = (front & (1 << i));
bool B = (back & (1 << i));
if (F)
bit_set(loc);
if (B)
bit_set(loc + 10);
i++;
loc++;
}
}
int compare(int b) {
int front = b >> 6;
int mask = (1 << 6) - 1;
int back = b&mask;
if (!bit_get(front + 1)){
//위에꺼 비교
int i = 0;
int loc = 10200;
int a = 0;
while (i < 6){
a *= 2;
a += (1 & bit_get(loc));
loc++;
i++;
}
if (front != a){
return front > a ? 1 : -1;
}
}
else{
//아래꺼 비교
int i = 0;
int loc = 10200 + 10;
int a = 0;
while (i < 6){
a *= 2;
a += (1 & bit_get(loc));
loc++;
i++;
}
if (back != a){
return back > a ? 1 : -1;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |