#include "cmp.h"
#include <vector>
using namespace std;
void remember(int a) {
vector<int> A, B;
for (int k = 0; k < 6; ++k) {
if ((a/64)>>k&1) A.push_back(k+1);
else B.push_back(k+1);
}
int base = (a/64 + 1)*7;
bit_set(base);
for (int k = 1; k < 7; ++k) {
if ((a%64)>>(k-1)&1) A.push_back(base+k);
else B.push_back(base+k);
}
if (size(A) > 6) {
bit_set(10240);
for (auto b : B) bit_set(b);
} else {
for (auto b : A) bit_set(b);
}
}
int compare(int b) {
int base = (b/64 + 1)*7;
int inv = bit_get(10240);
if (bit_get(base)) {
int a = (b/64) << 6;
for (int k = 1; k < 7; ++k) {
if (bit_get(base+k) xor inv) {
a |= 1<<(k-1);
}
}
if (b < a) return -1;
if (b == a) return 0;
if (b > a) return 1;
} else {
int a = 0;
for (int k = 0; k < 6; ++k) {
if (bit_get(k+1) xor inv) a |= (1<<k) * 64;
}
if (b < a) return -1;
if (b == a) return 0;
if (b > a) return 1;
}
return 100;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1764 ms |
83316 KB |
Output is partially correct - maxAccess = 15, score = 55 |