# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
4738 |
2013-12-23T13:30:21 Z |
kipa00 |
cmp (balkan11_cmp) |
C++ |
|
2 ms |
760 KB |
#include "cmp.h"
void remember (int value) {
int a[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int c = 12, cnt = 0;
while (c--) {
a[c] = value & 1;
if (value & 1) {
++cnt;
}
value >>= 1;
}
if (cnt > 6) {
bit_set(0);
for (c=0; c<12; ++c) {
if (!a[c]) bit_set(c + 1);
}
} else for (c=0; c<12; ++c) {
if (a[c]) bit_set(c + 1);
}
}
int compare (int value) {
int inverse = bit_get(0);
int i, num = 0;
for (i=0; i<12; ++i) {
num <<= 1;
num |= inverse ^ bit_get(i + 1);
}
if (value < num) {
return -1;
} else if (value == num) {
return 0;
}
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
760 KB |
ZERO POINTS: bit_set with addr out of range 0 |