complete 1764.cpp 10816.cpp 25793.kt
This commit is contained in:
55
storage/zeta/cpp/completed/1764.cpp
Normal file
55
storage/zeta/cpp/completed/1764.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void fastio() {
|
||||
ios_base::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
cout.tie(nullptr);
|
||||
}
|
||||
|
||||
int main() {
|
||||
fastio();
|
||||
|
||||
int n, m;
|
||||
|
||||
cin >> n >> m;
|
||||
|
||||
auto 듣도못한사람 = new set<string>();
|
||||
auto 보도못한사람 = new set<string>();
|
||||
for (auto i = 0; i < n; i++) {
|
||||
string name;
|
||||
cin >> name;
|
||||
듣도못한사람->insert(name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (auto j = 0; j < m; j++) {
|
||||
string name;
|
||||
cin >> name;
|
||||
보도못한사람->insert(name);
|
||||
}
|
||||
|
||||
auto 듣도보도못한사람 = new vector<string>();
|
||||
set_intersection(
|
||||
듣도못한사람->begin(), 듣도못한사람->end(),
|
||||
보도못한사람->begin(), 보도못한사람->end(),
|
||||
back_inserter(*듣도보도못한사람)
|
||||
);
|
||||
|
||||
cout << 듣도보도못한사람->size() << "\n";
|
||||
for (auto name: *듣도보도못한사람) {
|
||||
cout << name << "\n";
|
||||
}
|
||||
|
||||
delete 듣도못한사람;
|
||||
delete 보도못한사람;
|
||||
delete 듣도보도못한사람;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user