Submission #743749

#TimeUsernameProblemLanguageResultExecution timeMemory
743749boyliguanhancmp (balkan11_cmp)C++17
100 / 100
1278 ms96024 KiB
#include "cmp.h" int pos[6]{1, 4097, 5121, 5377, 5441, 5457}; void remember(int n) { for(int i = 0; i < 6; i++) bit_set(pos[i]+(n>>i*2)); } int compare(int b) { int l = 0, r = 6; while(l < r) { int mid = l+r>>1; if(bit_get(pos[mid]+(b>>mid*2)))r= mid; else l = mid+1; } if(!l) return 0; int d = b>>2*l-2&3; if(d>1) if(bit_get((((b>>l*2)<<2)+3)+pos[l-1])) return -1; else return 1; else if(bit_get(((b>>l*2)<<2)+pos[l-1])) return 1; else return -1; }

Compilation message (stderr)

cmp.cpp: In function 'int compare(int)':
cmp.cpp:9:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    9 |         int mid = l+r>>1;
      |                   ~^~
cmp.cpp:14:19: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   14 |     int d = b>>2*l-2&3;
      |                ~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...