# 단순구현 # 스까묵자
노설명....
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int n, qn;
string gr[100];
vector<string> mb[100];
int main()
{
cin >> n >> qn;
for (int i = 0; i < n; i++)
{
cin >> gr[i];
int a;
cin >> a;
for (int j = 0; j < a; j++)
{
string st;
cin >> st;
mb[i].push_back(st);
}
sort(mb[i].begin(), mb[i].end());
}
for (int i = 0; i < qn; i++)
{
int t;
string tmp;
int k;
cin >> tmp >> k;
if (k == 0)
{
for (t = 0; t < n; t++)
{
if (gr[t] == tmp)
{
for (auto & j : mb[t])
cout << j << "\n";
break;
}
}
}
else
{
for (int j = 0; j < n; j++)
{
bool aaa = false;
for (auto &k : mb[j])
{
if (k == tmp)
{
cout << gr[j] << "\n";
aaa = true;
break;
}
}
if (aaa == true)
break;
}
}
}
return 0;
}'IT > BOJ' 카테고리의 다른 글
| 백준(BOJ) 16167 A Great Way * (0) | 2018.10.04 |
|---|---|
| 백준(BOJ) 16166 서울의 지하철 * (0) | 2018.10.04 |
| 백준(BOJ) 2316 도시 왕복하기 *** (0) | 2018.10.01 |
| 백준(BOJ) 11585 속타는 저녘 메뉴 ** (0) | 2018.09.30 |
| 백준(BOJ) 1298 노트북 주인을 찾아서 ** (0) | 2018.09.30 |