hellow, cf frined
u can go to my submission and check the last problem c in my submission, that has got ac, but how idk. Can anyone explain the right approach
I go to google;s xor calculator and input some values, find a pattern, and implement it with a random guess , and it has got AC :)
pls help,
Thanks in advance.:) here is it how it passed
x-1 to 1??
nah vai oitha test er jonow contest shese didis contest time e aktha ac hosisilow ar age dharan link dei Your text to link here...
if you know binary search, it was simple simulation, i dont know why so many people were worried to make bitwise operations on that!
how do you show monotonicity on the range of y?
thanks
it was said y would lie from 1 to x-1, so that is our range, then we will check for mid, and see if x^mid < x+mid and x^mid > x-mid, if both conditions are satisfied it is a valid y, so print it, think about it, is much easier than what others did
Auto comment: topic has been updated by arifin_fuad_kashfy (previous revision, new revision, compare).
what is "__builtin_clz(x)": This counts the number of leading zeros in the binary representation of x.
eg:
If x = 5 (binary 101), the number of leading zeros is 29 (assuming a 32-bit integer, since 5 is 000xxx000101).
If x = 8 (binary 1000), the number of leading zeros is 28.
If x = 5 (binary 101), 32 — __builtin_clz(5) — 1 = 3 — 1 = 2.
If x = 8 (binary 1000), 32 — __builtin_clz(8) — 1 = 4 — 1 = 3.
TRY THIS CODE-->