Advertisement
Guest User

asass

a guest
Oct 4th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 0.90 KB | None | 0 0
  1. def cin():
  2.     return list(map(int, input().split()))
  3.  
  4.  
  5. ans = True
  6.  
  7. t = int(input())
  8. n = int(input())
  9.  
  10. cnt = [0 for x in range(100000)]
  11.  
  12. d = cin()
  13. for x in range(t):
  14.     r = cin()
  15.  
  16.     s = sum(r)
  17.     bar = []
  18.     for i in range(s):
  19.         tmp = cin()
  20.  
  21.         if len(bar) != 0:
  22.             # ToDo: add formula
  23.             pass
  24.  
  25.         for j in tmp:
  26.             if j > s:
  27.                 ans = False
  28.                 break
  29.  
  30.         for j in tmp:
  31.             cnt[j] += 1
  32.  
  33.             if cnt[j] > 1:
  34.                 ans = False
  35.                 break
  36.  
  37.         bar = tmp
  38.  
  39.     if not ans:
  40.         print('No')
  41.         ans = True
  42.         continue
  43.  
  44.     for j in range(1, s + 1):
  45.         if cnt[j] != 1:
  46.             ans = False
  47.             break
  48.  
  49.     if not ans:
  50.         print('No')
  51.         ans = True
  52.         continue
  53.  
  54.     print("Yes")
  55.  
  56.     cnt = [0 for x in range(100000)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement