Create 1600.cpp

This commit is contained in:
KiritoTRw 2016-05-22 23:06:38 +08:00
parent 3a84d2d28c
commit 7b4f83ff48

37
QUSTOJ/1600.cpp Normal file
View File

@ -0,0 +1,37 @@
#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int a, b, c;
string name;
while (cin >> a >> b >> c) {
set<string> s;
vector<string> v;
for (int i=0; i<a; i++) {
cin >> name;
s.insert(name);
}
for (int j=0; j<b; j++) {
cin >> name;
if (s.count(name)) v.push_back(name);
}
for (int k=0; k<c; k++) {
cin >> name;
for (int i=0; i<v.size(); i++) {
if (v[i] == name) {
v.erase(v.begin()+i);
}
}
}
if (v.empty()) cout << "No enemy spy\n";
else {
int sz = v.size();
cout << v[0];
for (int i=1; i<sz; i++)
cout << " " << v[i];
cout << "\n";
}
}
return 0;
}