| 
 | 
вернуться в форумHelp me (Python) Time limit. Where is my mistake? cnt1 = int(input()) lst1 = input() lst1 = lst1.split() cnt2 = int(input()) lst2 = input() lst2 = lst2.split() cnt3 = int(input()) lst3 = input() lst3 = lst3.split() cnt = 0 for i in range(cnt1):     for j in range(cnt2):         if lst1[i] == lst2[j]:              for k in range(cnt3):                     if lst1[i] == lst3[k]:                         cnt += 1         else:              continue print(cnt)   Edited by author 31.10.2017 14:42 Re: Help me (Python) Послано  misha 31 май 2018 14:24 Your code has O(cnt1 * cnt2 * cn3). If cnt1 is 4000, cnt2 is 4000, cnt3 is 4000, Your code will work (4000*4000*4000)/10^8 seconds. 640 seconds. 640 > 0.5 Re: Help me (Python) I agree 640>0.5     Edited by author 15.07.2018 02:43   Edited by author 15.07.2018 02:43 Ac a = input() A = list(map(int , input().split())) a = input() B = list(map(int , input().split())) a = input() C = list(map(int , input().split())) print(len(set(A) & set(B) & set(C)))  |  
  | 
|