[백준] 17219번 비밀번호 찾기 (C++, 해시)

728x90
반응형

 

 

#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <unordered_map>
using namespace std;

int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(NULL);


	int n, m;
	cin >> n >> m;
	unordered_map<string, string> hash;
	string add, pass;
	for (int i = 0; i < n; i++) {
		cin >> add >> pass;
		hash[add] = pass;
	}
	string tmp;
	for (int i = 0; i < m; i++) {
		cin >> tmp;
		cout << hash[tmp] << "\n";
	}


	return 0;
}
728x90
반응형
TAGS.

Comments