#include <bits/stdc++.h>
#include "cmp.h"
size_t y[6] = {
1,
4097,
5121,
5377,
5441,
5457};
void remember(int n)
{
for (size_t i = 0; i < 6; i++)
bit_set((n >> (2 * i)) + y[i]);
}
int compare(int b)
{
size_t u = 0, v = 6;
while (u < v)
{
size_t m = (u + v + 1) / 2;
if (bit_get(b >> (2 * m)) + y[m])
v = m;
else
u = m + 1;
}
if (!u)
return 0;
int last = ((b >> (2 * (u - 1))) & 3);
if (!last)
return -1;
if (last == 3)
return 1;
if (last == 1)
return bit_get(4 * (b >> (2 * u)) + y[u - 1]) ? 1 : -1;
return bit_get(4 * (b >> (2 * u)) + 3 + y[u - 1]) ? -1 : 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
10050 ms |
95972 KB |
Time limit exceeded |