Submission #41080

#TimeUsernameProblemLanguageResultExecution timeMemory
41080hsb154cmp (balkan11_cmp)C++14
91 / 100
1814 ms92960 KiB
#include "cmp.h" void remember(int n) { int mask = 7 << 9; int me = 0; int shift = 9; for (int i = 0; mask; i++) { me = me * 8 + ((mask&n) >> shift)+1; bit_set(me); shift -= 3; mask >>= 3; } } int compare(int b) { int ret; int mask = 7 << 9; int shift = 9; int me = 0; for(int i=0;i<4;i++){ int temp_me = me * 8 + ((mask&b) >> shift) + 1; if(bit_get(temp_me)==0){ int left = me * 8 + 1; int right = me * 8 + 8; if (temp_me - left < right - temp_me) { for (int m = temp_me - 1; m >= left; m--) { if (bit_get(m) == 1) return 1; } return -1; } else { for (int m = temp_me +1; m <= right; m++) { if (bit_get(m) == 1) return -1; } return 1; } } me = temp_me; mask >>= 3; shift -= 3; } return 0; }

Compilation message (stderr)

cmp.cpp: In function 'int compare(int)':
cmp.cpp:19:6: warning: unused variable 'ret' [-Wunused-variable]
  int ret;
      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...