#include "cmp.h"
void remember(int a)
{
int x=a>>9&7;
int y=a>>6&7;
int z=a>>4&3;
int o=a>>2&3;
int p=a&3;
bit_set(x+1);
bit_set(y+9);
bit_set(z+17);
bit_set(o+21);
bit_set(p+25);
}
int compare(int b)
{
int x=b>>9&7;
int y=b>>6&7;
int z=b>>4&3;
int o=b>>2&3;
int p=b&3;
if(bit_get(x+1))
{
if(bit_get(y+9))
{
if(bit_get(z+17))
{
if(bit_get(o+21))
{
if(bit_get(p+25)) return 0;
else
{
if(p>1)
{
for(int i=p+1;i<4;i++) if(bit_get(i+25)) return -1;
return 1;
}
else
{
for(int i=p-1;i>=0;i--) if(bit_get(i+25)) return 1;
return -1;
}
}
}
else
{
if(o>1)
{
for(int i=o+1;i<4;i++) if(bit_get(i+21)) return -1;
return 1;
}
else
{
for(int i=o-1;i>=0;i--) if(bit_get(i+21)) return 1;
return -1;
}
}
}
else
{
if(z>1)
{
for(int i=z+1;i<4;i++) if(bit_get(i+17)) return -1;
return 1;
}
else
{
for(int i=z-1;i>=0;i--) if(bit_get(i+17)) return 1;
return -1;
}
}
}
else
{
if(y>3)
{
for(int i=y+1;i<8;i++) if(bit_get(i+9)) return -1;
return 1;
}
else
{
for(int i=y-1;i>=0;i--) if(bit_get(i+9)) return 1;
return -1;
}
}
}
else
{
if(x>3)
{
for(int i=x+1;i<8;i++) if(bit_get(i+1)) return -1;
return 1;
}
else
{
for(int i=x-1;i>=0;i--) if(bit_get(i+1)) return 1;
return -1;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1604 ms |
82760 KB |
Output is partially correct - maxAccess = 11, score = 91 |