알고리즘

C++ 알고리즘 - 백준 17219 비밀번호 찾기

마루설아 2025. 1. 4. 19:58

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

 

#include <bits/stdc++.h>
#include <unordered_map>
#define endl "\n"

using namespace std;

int main(void) {
	/************** C++ Init **************/
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	/************** C++ Init **************/


	int input1, input2;
	string str1, str2;
	unordered_map<string, string> um;
	cin >> input1 >> input2;

	for (int i = 0; i < input1; i++) {
		cin >> str1 >> str2;
		um.insert({ str1, str2 });
	}

	for (int i = 0; i < input2; i++) {
		cin >> str1;
		cout << um[str1] << endl;
	}
}