Hacked
I guess it's quite difficult to make a set of test data that TLEs all possible choices of $B$, so $O((n + q) n^{\frac{2}{3}})$ solutions can get accepted, although they can then be hacked (including all but one of the in-contest submissions lol)
Hacked
I guess it's quite difficult to make a set of test data that TLEs all possible choices of $B$, so $O((n + q) n^{\frac{2}{3}})$ solutions can get accepted, although they can then be hacked (including all but one of the in-contest submissions lol)