Submission #4739

# Submission time Handle Problem Language Result Execution time Memory
4739 2013-12-23T13:31:17 Z kipa00 cmp (balkan11_cmp) C++
19 / 100
2488 ms 82476 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(1);
    for (c=0; c<12; ++c) {
      if (!a[c]) bit_set(c + 2);
    }
  } else for (c=0; c<12; ++c) {
    if (a[c]) bit_set(c + 2);
  }
}
int compare (int value) {
  int inverse = bit_get(1);
  int i, num = 0;
  for (i=0; i<12; ++i) {
    num <<= 1;
    num |= inverse ^ bit_get(i + 2);
  }
  if (value < num) {
    return -1;
  } else if (value == num) {
    return 0;
  }
  return 1;
}
# Verdict Execution time Memory Grader output
1 Partially correct 2488 ms 82476 KB Output is partially correct - maxAccess = 19, score = 19