Is there any way to test my solution for SmackDown ?

I tried attempting the TEAMMATE problem of SnackDown Online Qualifier Round many times, but got time limit exceeded. I have tried making another solution for it and want to test whether this one works, not for Rank but just for satisfaction is there anyway to do it?

The problem should show up sooner or later in the practice section, probably at TEAMMATE. In the meantime you could write a test generator and fetch one of the accepted solutions (which are all public now) and check that you get the same answer as the accepted solution.

For reference, a generator to play around with for this task would be something like the (python 2 or python 3) code

from __future__ import print_function
import sys
if sys.version_info < (3, 0):
    range = xrange

from random import randrange

# t in range [1,1000]
t = 10
print(t)

for _ in range(t):
    # n even number in range [2,10**5]
    n = randrange(2,10**5+1,2)
    print(n)

    # S_i in range [1,10**6]
    S = [randrange(1,1001) for _ in range(n)]
    print(*S)

As a reference accepted solution you could look at my team’s solution written in python 2.

2 Likes

@algmyr also, could you please explain why this solution in Python 3
is getting runtime error NZEC?

All the lines with factorials are sketchy. The main problem is that you’re using floating point division / rather than integer division // in a lot of places, including the division of the factorials.

But even if that is fixed your solution should get TLE, but at least it would no longer be NZEC. To avoid TLE you need to avoid computing with too large numbers, make use of the mod when calculating stuff!