fork(1) download
  1. # your code goes import fractions
  2. t=input()
  3. while(t>=0):
  4. i=1
  5. max=1
  6. count=1
  7. n=input()
  8. mlt=input()
  9. while(i<n):
  10. i=i+1
  11. a=input()
  12. if(gcd(mlt,a)==1):
  13. count=count+1
  14. mlt=mlt*a
  15. prv=a
  16. else:
  17. if(max<count):
  18. max=count
  19. count=1
  20. mlt=a
  21. if(gcd(prv,a)==1):
  22. count=2;
  23. mlt=prv*a
  24. prv=a
  25. else:
  26. mlt=a
  27. count=1
  28. if(max==1):
  29. print(-1)
  30. else:
  31. print(max)
  32. t=t-1
  33.  
Runtime error #stdin #stdout #stderr 0.09s 8904KB
stdin
1
4
2
4
5
6
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 12, in <module>
NameError: name 'gcd' is not defined