Mutual Indivisibility

  • + 0 comments

    why this solution isnt valid (it gave me same out put as cases but the site give me time error )? t= int(input().strip()) l=[] for a0 in range(t): a, b, x = input().strip().split(' ') a, b, x = [int(a), int(b), int(x)] xx=list(range(int(a),int(b)+1)) n=int(x) xxx=list(reversed(xx)) for x0 in xxx : y=[x0] for x1 in xxx : for y0 in y: if x1 % y0 !=0 and y0 %x1 !=0 : z = 1 else: z=2 break if z ==1: y.append(x1) if len(y)== n: break if len(y)== n: l.append(y) break elif len(y) != n and xxx.index(x0) for l0 in l: if type(l0)==type([]): for x0 in l0: z.append(str(x0)) print(" ".join(z)) z.clear() else: print(l0)