Baekjoon #1620

Baekjoon #1620

1개의 풀이 · C++

문제 원문 보기 ↗

SOLUTION INFO

C++ · main.cpp

main.cpp
#include<bits/stdc++.h>

using namespace std;

unordered_map<string, string> pokemon;
unordered_map<string, string> pokemonSeq;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N, Q; cin >> N >> Q;
    for(int i=1;i<=N;i++){
        string s; cin >> s;
        string idx = to_string(i);
        pokemon[s]      = idx;
        pokemonSeq[idx] = s;
    }
    
    while(Q--) {
        string s; cin >> s;
        if(isdigit(s[0])) {
            cout << pokemonSeq[s] << '\n';
        }
        else {
            cout << pokemon[s] << '\n';
        }
    }

    return 0;
}

SOLUTION DESCRIPTION

풀이 설명

등록된 풀이 설명이 없습니다.