I am not able to remove TLE error from this. Here are the original constraints for the problem. 1≤T≤1,000 1≤N≤105 1≤Ai≤N for each valid i the sum of N over all test cases does not exceed 2⋅10^5.
x=int(input()) list=[] for i in range(x): y=int(input()) z=input().split() z.insert(0,0.3) list.append(z) for i in list: print(happy(i)) SubTask Task # Result (time) 1 0 AC (0.020000) Subtask Score: 27.00% Result  AC 2 1 AC (0.020000) 2 2 TLE (5.010000) 2 3 TLE (5.010000) Subtask Score: 0.00% Result  TLE Total Score = 27.00% I have tried to think about other algorithms but cant find better than this. Maybe problem lies in the input part, which increases time. asked 08 Nov, 14:07
