SaveText.Ru

Без имени
  1. nums = list(map(int, input().split()))
  2.  
  3. dishes = dict()
  4.  
  5. for i in range(nums[0]):
  6.     dish_info = tuple(input().split())
  7.     dishes[dish_info[0]] = int(dish_info[1])
  8.  
  9. for i in range(nums[1]):
  10.     dish_name = input()
  11.    
  12.     if dish_name in dishes:
  13.         print(dishes[dish_name])
  14.     else:
  15.         print(-1)
  16.  
  17.    
  18.    

Share with your friends:

Print