# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
44069 |
2018-03-29T15:09:59 Z |
dhkim0225 |
cmp (balkan11_cmp) |
C++14 |
|
2204 ms |
94584 KB |
#include "cmp.h"
void remember(int n) {
for (int i = 4; i >= 1; i--) {
if (n >= 8) {
int r = n % 8;
n /= 8;
bit_set(i * 1000 + r);
}
else if (n == 0)
bit_set(i * 1000);
else {
bit_set(i * 1000 + n);
n = 0;
}
}
}
int compare(int b) {
int base4[5] = { 0, };
for (int i = 4; i >= 1; i--) {
if (b >= 8) {
base4[i] = (b % 8);
b /= 8;
}
else {
base4[i] = b;
break;
}
}
for (int i = 1; i <= 4; i++) {
if (bit_get(1000 * i + base4[i]))
continue;
else {
if (base4[i] >= 4) {
for (int j = base4[i] + 1; j < 8; j++) {
if (bit_get(1000 * i + j))
return -1;
}
return 1;
}
else {
for (int j = base4[i] - 1; j >= 0; j--) {
if (bit_get(1000 * i + j))
return 1;
}
return -1;
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2204 ms |
94584 KB |
Output is partially correct - maxAccess = 11, score = 91 |