# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
41556 |
2018-02-18T23:11:05 Z |
pica4500 |
cmp (balkan11_cmp) |
C++ |
|
1825 ms |
83960 KB |
#include "cmp.h"
//82점 비벼욧---!!!
//2bit compression
int getIdx(int n, int kth) {
kth *= 2; //2kth Idx
n >>= (kth - 2);
n %= 4;
return (10000 + (kth * 2) - 3 + n);
}
void remember(int n) {
for (int i = 6; i > 0; i--) bit_set(getIdx(n, i));
int up = (n >> 6) + 1;
bit_set(100 + up);
}
int compare(int b) {
int up = (b >> 6) + 1;
if (bit_get(100 + up)) {
for (int i = 3; i > 0; i--) {
int idx = getIdx(b, i);
if (bit_get(idx)) continue;
int c = (((idx - 10000) - 1) % 4) + 1;
switch(c) {
case 1:
return -1;
case 2:
if (bit_get(idx - 1)) return 1;
return -1;
case 3:
if (bit_get(idx + 1)) return -1;
return 1;
case 4:
return 1;
}
}
return 0;
}
else {
for (int i = 6; i > 3; i--) {
int idx = getIdx(b, i);
if (bit_get(idx)) continue;
int c = (((idx - 10000) - 1) % 4) + 1;
switch (c) {
case 1:
return -1;
case 2:
if (bit_get(idx - 1)) return 1;
return -1;
case 3:
if (bit_get(idx + 1)) return -1;
return 1;
case 4:
return 1;
}
}
return 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1825 ms |
83960 KB |
Output is partially correct - maxAccess = 12, score = 82 |