Comments

I too, as an python main, really struggled upon this specific matter. Hope this change ships soon so that more people can focus and enjoy the nature of problem-solving with python, not exploring some deprecated features just to make some plain old multiplications to get going.

(I kind of misunderstood what you said, so I'm rewriting my comment.)

That sentence means how to handle cases like 3 0 0 or 0 0 4.

For 3 0 0 you need 0000, and for 0 0 4 you should output 11111.

Testcases such as 3 0 3 will not appear at all, since there must exist "01" or "10" somewhere so there is no solution for this case. The problem statement says that impossible testcases will not be given.

I suspect that math.floor(n/m) is the culprit, and changing it to n//m may solve the issue.

Internally, math.floor should use floating point arithmetic with double precision, leading to inexact results when used to calculate large integers.

>>> n = 9999999999999999 # 10**16 - 1
>>> m = 2
>>> int(math.floor(n/m))
5000000000000000L
>>> n//m
4999999999999999L
On grphilCodeforces Round #549, 7 years ago
0

maybe 799999999?