## Editorial for TLE '17 Contest 7 P3 - Countless Calculator Computations

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

Author: leonchen0613

I wrote this problem in response to CCC 2018. That final year, I tied with 12 others for a score of 54. Because that would mean that 38 people would have gone to CCO, and typically less than 30 people are invited, the cutoff was set to 56 instead.

I was excluded.

After that, I developed depression. I lost all my will to do anything. I gave up on life.

Despite having worked so hard, I ended up falling 2 points short. My heart goes out to everyone else who has or will suffer from the same fate. To whom it may concern, yes, I'm talking to you.

Moral of the story: If you do well on the CCC, but not well enough to make CCO, then your hard work was all for nothing.

. . .

The above statement is absolutely wrong. (Happy April Fools)

I realized that there was so much valuable knowledge and experience that I have gained on that journey. We are so driven by our ambitions that we, like machines, become broken upon failure. But we are not machines - we are human. And humans make mistakes and learn from them.

Like Beethoven, I found my resolution in composing music. And in doing well at school. And in hanging out with friends. There is so much more to life than just making CCO (or even IOI).

So if you fail, it's not the end of the world. Let's have a drink (actually, probably not, since you're likely underage). "You'll be fine."

Anyways, back to the problem.

Firstly, note that the function is monotonous. Therefore, we can binary search for an approximate value of that yields .

The lower bound of is since , and the upper bound of can be set to since and . Simply setting the upper bound of to may result in a TLE.

Applying this, the problem can therefore be solved in time, where represents the maximum number of binary search trials in order to pinpoint within an absolute error of .

EDIT: P.S. I still got accepted into Waterloo Computer Science so it's all good :)