| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 147946 | evpipis | 비교 (balkan11_cmp) | C++11 | 1593 ms | 82552 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cmp.h"
const int lg = 12, k = 3;
int match(int pos, int num){
return pos*(1<<k) + num + 1;
}
void remember(int a) {
for (int pos = lg/k-1; pos >= 0; pos--){
int num = (a>>(k*pos))%(1<<k);
bit_set(match(pos, num));
//printf("pos = %d, num = %d, match = %d\n", pos, num, match(pos, num));
}
}
int compare(int b) {
for (int pos = lg/k-1; pos >= 0; pos--){
int num = (b>>(k*pos))%(1<<k);
if (bit_get(match(pos, num)))
continue;
if (num < (1<<k)/2){
for (int j = 0; j < num; j++)
if (bit_get(match(pos, j)))
return 1;
return -1;
}
else{
for (int j = (1<<k)-1; j > num; j--)
if (bit_get(match(pos, j)))
return -1;
return 1;
}
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
