FBMT:NZEC error python

https://www.codechef.com/viewsolution/16641553

This solution gives NZEC error.
How to fix it?

I don’t know python but keep in mind N can be 0(see constraints)

1 Like

It’s simple bro. In python2.7 input() is use to take integer input and raw_input() is used to take string input.
In line 9 of your code you are using input() which is wrong. You must use raw_input().
Hope it helps.

There are two issuses with your code:

  1. As @kunnu120 mentioned your code gives NZEC for n=0.

  2. And also for inputs like this, your code also throws NZEC:

    3
    aa
    aa
    aa

Hope this helps!

for n==0 and the case when their is only one team say their are 5 round and all are won by team a then according to your code b is not in the dict and when b is passed into the dict it will give NZEC error because the element b is not in the dict and you are trying to call it

The constraints states that “for each test case, there are at most two different team names”, so there can be a case when there is only one team name, in which case your line 17 would thorough a KeyError. Also when n=0, same line 17 would through KeyError.

Try these tests:
#1)
1

2

ab

ab

#2)
1

0