Submission #420078

#TimeUsernameProblemLanguageResultExecution timeMemory
420078maximath_1cmp (balkan11_cmp)C++11
100 / 100
2068 ms102172 KiB
#include "cmp.h" using namespace std; int cnt = 0; void remember(int n){ n += 4096; for(; n > 1; n >>= 2, cnt ++) bit_set(n); } int compare(int a){ a += 4096; int lf = 0, rg = 6, gt = -1; for(int md; lf <= rg;){ md = (lf + rg) >> 1; if(md != 6 && !bit_get(a >> (md * 2))){ gt = a >> (md * 2); lf = md + 1; }else rg = md - 1; } if(gt == -1) return 0; if(gt % 4 == 0) return -1; else if(gt % 4 == 1) return bit_get(gt / 4 * 4) ? 1 : -1; else if(gt % 4 == 2) return bit_get(gt / 4 * 4 + 3) ? -1 : 1; else return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...