Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 정석
- bfs
- DP
- cs
- 컴공
- 코딩
- 알고리즘
- 문제풀이
- vector
- Operating System
- 스택
- 오에스
- 자료구조
- 북리뷰
- Computer science
- 오퍼레이팅시스템
- 정석학술정보관
- 백준
- 그래프
- Stack
- 구현
- 개발
- 브루트포스
- 코테
- 너비우선탐색
- coding
- 컴공과
- 컴퓨터공학과
- c++
- OS
Archives
- Today
- Total
Little Jay
[C++] 백준 17219번 - 비밀번호 찾기 본문
map을 이용해서 풀면 간단히 해결할 수 있는 문제
linux 채점환경이기때문에 시간초과가 나지 않으려면
ios::sync_with_stdio(false);
cin.tie(0);
를 추가해주어야 한다
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
string site, pw;
map<string, string> mp;
for (int i = 0; i < n; i++) {
cin >> site >> pw;
mp.insert(pair<string, string>(site, pw));
}
for (int i = 0; i < m; i++) {
cin >> site;
cout << mp.find(site)->second << "\n";
}
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
[C++] 백준 11399번 - ATM (0) | 2021.08.16 |
---|---|
[C++] 백준 1463번 - 1로 만들기 (0) | 2021.08.16 |
[C++] 백준 11723번 - 집합 (0) | 2021.08.14 |
[C++] 백준 2417번 - 정수 제곱근 (0) | 2021.08.08 |
[C++] 백준 13777번 - Hunt The Rabbit (0) | 2021.08.08 |
Comments