Submission #45450

#TimeUsernameProblemLanguageResultExecution timeMemory
45450smu201111192cmp (balkan11_cmp)C++17
100 / 100
2125 ms102136 KiB
#include "cmp.h" #include <cassert> using namespace std; void remember(int n) { n += 4096; while (n > 1){ bit_set(n); n /= 4; } } int compare(int b) { b += 4096; int lo = 0; int hi = 6; int same = 1; int rem = 0; while (lo <= hi){ int mid = (lo + hi) / 2; if (!bit_get(b >> (mid * 2)) && mid != 6) { lo = mid + 1; rem = b >> (mid * 2); same = 0; } else { hi = mid - 1;} } if (same) return 0; if (rem % 4 == 0){ return -1; } else if (rem % 4 == 1){ int ask1 = rem / 4 * 4 + 0; int ask2 = rem / 4 * 4 + 3; 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; } }

Compilation message (stderr)

cmp.cpp: In function 'int compare(int)':
cmp.cpp:33:7: warning: unused variable 'ask1' [-Wunused-variable]
   int ask1 = rem / 4 * 4 + 0;
       ^~~~
cmp.cpp:34:7: warning: unused variable 'ask2' [-Wunused-variable]
   int ask2 = rem / 4 * 4 + 3; 
       ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...