#include "cmp.h"
void remember(int n) {
// printf("n %d : %d %d %d %d\n", n, 1 + n, 4097 + n/6, 5057 + n/48, 5177 + n/480);
bit_set(1 + n);
bit_set(4097 + n/6);
bit_set(5057 + n/48);
bit_set(5177 + n/480);
}
int compare(int b) {
int i;
if (!bit_get(5177 + b/480))
{
// printf("%d\n", 5177 + b/480);
if (b/480 < 6)
{
for (i = b/480 - 1; i >= 0; i--)
{
if (bit_get(5177 + i))
return 1;
}
return -1;
}
else
{
for (i = b/480 + 1; i < 12; i++)
{
// printf("%d\n", 5177 + i);
if (bit_get(5177 + i))
return -1;
}
return 1;
}
}
// printf("a\n");
if (!bit_get(5057 + b/48))
{
// printf("%d\n", 5057 + b/48);
int c = (b/48)%10;
// printf("c %d\n", c);
if (c < 5)
{
for (i = c - 1; i >= 0; i--)
{
if (bit_get(5057 + b/48 - c + i))
return 1;
}
return -1;
}
else
{
for (i = c + 1; i < 10; i++)
{
// printf("i %d %d\n", i, 5057 + b/48 - c + i);
if (bit_get(5057 + b/48 - c + i))
return -1;
}
// printf("!\n");
return 1;
}
}
// printf("b\n");
if (!bit_get(4097 + b/6))
{
int c = (b/6)%8;
if (c < 4)
{
for (i = c - 1; i >= 0; i--)
if (bit_get(4097 + b/6 - c + i))
return 1;
return -1;
}
else
{
for (i = c + 1; i < 8; i++)
if (bit_get(4097 + b/6 - c + i))
return -1;
return 1;
}
}
// printf("c\n");
if (!bit_get(1 + b))
{
int c = b%6;
if (c < 3)
{
for (i = c - 1; i >= 0; i--)
if (bit_get(1 + b - c + i))
return 1;
return -1;
}
else
{
for (i = c + 1; i < 6; i++)
if (bit_get(1 + b - c + i))
return -1;
return 1;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1949 ms |
94976 KB |
Output is correct - maxAccess = 10, score = 100 |