Submission #530861

# Submission time Handle Problem Language Result Execution time Memory
530861 2022-02-27T02:23:59 Z KoD cmp (balkan11_cmp) C++17
0 / 100
652 ms 90552 KB
#include "cmp.h"

void remember(int n) {
  for (int i = 0; i < 6; ++i) {
    bit_set(n + 1);
    n >>= 2;
  }
}

int compare(int b) {
  int ok = 6, ng = -1;
  while (ok - ng > 1) {
    const int md = (ok + ng) / 2;
    if (bit_get((b >> (2 * md)) + 1)) {
      ok = md;
    } else {
      ng = md;
    }
  }
  if (ok == 0) {
    return 0;
  }
  const int same = b >> (2 * ok);
  const int bit = (b >> (2 * ng)) & 3;
  if (bit <= 1) {
    return bit_get(4 * same + 1) ? 1 : -1; 
  } else {
    return bit_get(4 * same + 4) ? -1 : 1;
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 652 ms 90552 KB ZERO POINTS: For a=63 and b=2676, correct answer is 1, got -1