Problem link : TRNSN Problem - CodeChef
I have the following solution for this problem.
lens = int(input())
arrs = sorted([int(x) for x in input().split()])
cnt = 0
for i in range(lens - 1):
cnt += arrs[i] != arrs[i + 1]
print(cnt)
another one
lens = int(input())
arrs = sorted([int(x) for x in input().split()])
cnt = 0
for i in range(1, lens):
if arrs[i] != arrs[i - 1]:
cnt += 1
print(cnt)
howerver looking at the submission i found this to be only AC solution in python 3
l=[]
while True:
try:
l+=list(map(int,input().split()))
except:
break
n=l[0]
del(l[0])
l.sort()
ans=0
for i in range(1,n):
if l[i]!=l[i-1]:
ans+=1
print(ans)
Can someone please tell me why my solution are getting NZEC and this solution does not.
Thanks in advance