@bohdan - can we get an extra testcase added to the Practice version?
1
999987
It’s a bit of a shame that we’ve got this "the sum of N over all test cases does not exceed 10^6"
constraint in there, as it makes the testcases weaker: perhaps it would have been better to ask for a Run-Length Encoded representation of the Smallest Beautiful Number instead of the number itself. Oh well
While I’m here, I might as well re-post mine: I was going to add an informal analysis of the expected runtime and maybe a proof that there are no N such that no N-digit numbers are beautiful, but got bored and gave up XD There’s some skeletal notes in there, as well as a few interesting factoids about some of the Worst Cases we’ll encounter for 1 \le N \le 1000000, which is how I came up with that counter-example Heavily-documented code, as always
I don’t think that these constraints allow some really bad solutions to pass, so for me, it’s OK.
The main reason why I put such a constraint into a problem is that I don’t know to want to do this task impossible for some languages (I don’t know whether sth like python will be ok to output 1e7 characters in 2 seconds). Maybe it could be done with sth like “output number of 1, number of 2, and so on in optimal answer”, but I don’t think that this way the problem becomes more interesting.
As I see, basically any solution with normal complexity passed, and those which have bad one can be easily fixed to put into TLE (if the idea behind them is correct).
Also, it is easy to prove (by construction) that the answer is never -1 for any positive integer N.
About adding testcase, I am not so familiar with that on codechef.