medajibka

4

May 14th, 2022 (edited)
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. if __name__ == '__main__':
  2.     N_Q = input().split(' ')
  3.     N = int(N_Q[0])
  4.     Q = int(N_Q[1])
  5.  
  6.     str_facts = []
  7.  
  8.     for i in range(Q):
  9.         str_facts.append(input().split(' '))
  10.  
  11.     facts = [[0] * 2 for i in range(Q)]
  12.  
  13.     for i in range(Q):
  14.         facts[i][0] = int(str_facts[i][0]) - 1
  15.         facts[i][1] = int(str_facts[i][1]) - 1
  16.  
  17.     is_contains = False
  18.     for i in range(N):
  19.         is_contains = False
  20.         for j in range(Q):
  21.             if i in facts[j]:
  22.                 is_contains = True
  23.  
  24.     if is_contains:
  25.         print("Yes")
  26.     else:
  27.         print("No")
  28.  
Add Comment
Please, Sign In to add comment