I accepted this problem during the training using a solution.

When I read the model solutions submitted by Mike, I found they are brute force too. And It will failed on a easy case *n* = 2^{18} - 1, *a*_{i} = *i*, *b*_{i} = *i* + 1.

Only my solution and Los_Angelos_Laycurse's solution pass this case.

I think we implemented more clever brute force solutions.

But I don't know how to prove my solution is right or construct some hard cases to make my solution TLE.

I really want to know: Is there any provable solution to solve this problem?