# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
49564 |
2018-05-31T10:04:34 Z |
tjd229 |
cmp (balkan11_cmp) |
C++11 |
|
2710 ms |
95996 KB |
#include "cmp.h"
void remember(int n) {
//edit this
int i;
int a = n;
int r[6];
for (i = 6; i--;){
r[i] = a % 4;
a >>= 2;
}
for (a = i = 0; i < 6; i++){
a += r[i] + 1;
bit_set(a);
a <<= 2;
}
}
int compare(int b) {
//edit this
int i;
int r[6];
int pt[6];
int a = b;
for (i = 6; i--;){
r[i] = a % 4;
a >>= 2;
}
for (a = i = 0; i < 6; i++){
pt[i] = a = a + r[i] + 1;
a <<= 2;
}
//bs
int bnd = 0;
int lo = 0;
int hi = 6;
while (lo <= hi){
int mid = (lo + hi) >> 1;
if (mid == 6) return 0;
if (bit_get(pt[mid])) lo = mid + 1;
else hi = mid - 1;
}
bnd = lo;
if (bnd == 6) return 0;
//printf("switch\n");
switch (r[bnd]){
case 0: return -1;
case 1:
return bit_get(pt[bnd] - r[bnd] + 0) ? 1 : -1;
case 2:
return bit_get(pt[bnd] - r[bnd] + 3) ? -1 : 1;
default: return 1;
}
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2710 ms |
95996 KB |
Output is correct - maxAccess = 10, score = 100 |