쏘ing

[Python] 백준 1620 나는야 포켓몬 마스터 이다솜 본문

알고리즘/CLASS 3

[Python] 백준 1620 나는야 포켓몬 마스터 이다솜

한민민 2022. 2. 21. 15:01

https://www.acmicpc.net/problem/1620

풀이

import sys

N, M = map(int, sys.stdin.readline().rstrip().split())

poke = {}

# 딕셔너리
# 번호 : 포켓몬 이름
# 포켓몬 이름 : 번호
for i in range(1, N+1):
    temp = sys.stdin.readline().rstrip()
    poke[str(i)] = temp
    poke[temp] = str(i)
    
for i in range(1, M+1):
    print(poke[sys.stdin.readline().rstrip()])

 

Comments