HI, I have a problem with “Good Sets Problem Code: ICPC16D”. The question seems to be easy but my code is giving wrong answer it seems. It actually works for example and test cases which I prepared. Can someone help me to find where the problem is. My code is :
def findans(n,arr):
global ans
ans= [0]*750001
val=0
arr.sort()
for i in range(len(arr)-1,-1,-1):
finddivs(i,arr)
print((sum(ans))%(10^9+7))
def finddivs(i,arr):
global ans
divs=1
for j in range(i+1,len(arr)):
if(arr[j]%arr[i]==0):
divs=(divs+ans[j])%(10^9+7)
ans[i]=divs
n=int(input().strip())
for i in range(n):
n1=int(input().strip())
arr=[int(temp) for temp in input().strip().split(' ')]
findans(n1,arr)