Submission #45449

#TimeUsernameProblemLanguageResultExecution timeMemory
45449smu201111192cmp (balkan11_cmp)C++17
0 / 100
1081 ms102232 KiB
#include "cmp.h" void remember(int n) { n += 4096; while (n > 1){ bit_set(n); n /= 4; } } int kth(int num,int k){ k = 6 - k; for (int i = 0; i < k; i++){ num /= 4; } return num; } int compare(int b) { int lo = 0; int hi = 6; int same = 1; while (lo <= hi){ int mid = (lo + hi) / 2; if (bit_get(kth(b, mid)) == 1) lo = mid + 1; else { hi = mid - 1; same = 0; } } if (same) return 0; int diff_pos = lo - 1; int rem = kth(b, diff_pos); if (rem % 4 == 0){ return -1; } else if (rem % 4 == 1){ return bit_get(rem / 4 * 4 + 0) ? 1 : -1; } else if (rem % 4 == 2){ return bit_get(rem / 4 * 4 + 3) ? -1 : 1; } else{ return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...