Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
KENEW authored Dec 18, 2020
1 parent 998d2e4 commit eae827e
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions 1764_듣보잡.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

string NString[500001];
string MString[500001];
vector<string> ResultStr;

int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

int N, M;
cin >> N >> M;

for (int i = 0; i < N; i++)
{
cin >> NString[i];
}
for (int i = 0; i < M; i++)
{
cin >> MString[i];
}

sort(MString, MString + M);

for (int i = 0; i < N; i++)
{
if (binary_search(MString, MString + M, NString[i]))
{
ResultStr.push_back(NString[i]);
}
}

sort(ResultStr.begin(), ResultStr.end());

cout << ResultStr.size() << '\n';

for (int i = 0; i < ResultStr.size(); i++)
{
cout << ResultStr[i] << '\n';
}

return 0;
}

0 comments on commit eae827e

Please sign in to comment.