NZEC run time error (TRAINSET)

i don’t understand why i am getting run time error while submitting the code in pyhton 3 although it is sucessfully executed…here is the link to my solution to the TRAINSET (begginer) problem
https://www.codechef.com/submit/TRAINSET

That’s not a link to your submission: this is, though :slight_smile:

When running your solution with the following test input:

1
5
cfaj 1
cfaj 1
cfaj 1
cfaj 1
cfaj 1

I got the error:

Traceback (most recent call last):
  File "./swati_ubnare-TRAINSET.py", line 14, in <module>
    w,b = j.split('')
AttributeError: 'list' object has no attribute 'split'

Edit:

In fact, trying your solution with the sample test input has the same result.

sorry, i put the wrong link …my code is showing TLE here is the right code…
https://www.codechef.com/submit/TRAINSET

That’s exactly the same link again XD

This is the one you mean :slight_smile:

i have done some changes to the code …

Ok - looks like this is your latest submission.

yes …this code is giving correct output…but it is showing Time limit exceeded

Yes, you have to use a bit of ingenuity and come up with a much faster approach :slight_smile:

Incidentally, the current approach is still incorrect, I think: for the testcase:

1
10
gkd 1
gkd 1
gkd 1
j 1
gkd 1
j 0
j 0
gkd 1
j 0
aa 1

I get the answer 9.

1 Like