#include "cmp.h"
#include <iostream>
using namespace std;
void remember(int n) {
int a = n >> 9;
int b = (n >> 6) & ((1<<3)-1);
int c = (n >> 3) & ((1<<3)-1);
int d = n & ((1<<3)-1);
bit_set(d + 1);
bit_set(c + 1 + (1<<3));
bit_set((a<<3) + b + 1 + (1<<6));
bit_set(a + 1 + (1<<12));
}
int check_triple(int n, int offset, int extra){
if (n >= 4){
for (int i = 7; i > n; i--)
if (bit_get(i + offset + extra))
return -1;
return 1;
}else{
for (int i = 0; i < n; i++)
if (bit_get(i + offset + extra))
return 1;
return -1;
}
}
int compare(int n) {
int a = n >> 9;
int b = (n >> 6) & ((1<<3)-1);
int c = (n >> 3) & ((1<<3)-1);
int d = n & ((1<<3)-1);
if (bit_get((a<<3) + b + 1 + (1<<6))){
if (bit_get(c + 1 + (1<<3))){
if (bit_get(d + 1)){
return 0;
}else{
return check_triple(d, 0, 1);
}
}else{
return check_triple(c, 0, 1 + (1<<3));
}
}else{
if (bit_get(a + 1 + (1<<12))){
return check_triple(b, a<<3, 1 + (1<<6));
}else{
return check_triple(a, 0, 1 + (1<<12));
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1904 ms |
99004 KB |
Output is correct - maxAccess = 10, score = 100 |