Submission #130278

#TimeUsernameProblemLanguageResultExecution timeMemory
130278howard1005cmp (balkan11_cmp)C++14
46 / 100
2194 ms105080 KiB
#include "cmp.h" typedef struct _bitr{ int min, max, idx1, idx2; }; _bitr bitr[10240]; void remember(int n) { int ntmp = n; int bi[12] = { 0, }; int i = 0, sum = 0; while (ntmp){ if (ntmp % 2){ bi[i] = 1; sum++; } i++; ntmp /= 2; } int bi_rev[12]; for (int a = 0; a < 12; a++) bi_rev[a] = bi[11 - a]; int idx = 1; for (int a = 0; a < 12; a++){ if (bi_rev[a]){ idx = 2 * idx + 1; bit_set(idx); } else{ idx = 2 * idx; bit_set(idx); } } } int compare(int b) { int l = 1, r = 12, m, c, same = 0; while (l <= r){ m = (l + r) / 2; c = (b >> (12 - m)) | (1 << m); if (bit_get(c)){ same = m; l = m + 1; } else{ r = m - 1; } } if (same == 12) return 0; else if ((b >> (11 - same)) & 1) return 1; else return -1; }

Compilation message (stderr)

cmp.cpp:3:1: warning: 'typedef' was ignored in this declaration
 typedef struct _bitr{
 ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...