-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1072.cpp
36 lines (34 loc) · 779 Bytes
/
1072.cpp
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
32
33
34
35
36
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
map<int, int> thing;
string name;
int N, M, m, temp, num, cntpeo = 0, cntth = 0;
cin >> N >> M;
for(int i = 0; i < M; i++){
cin >> temp;
thing[temp] = 1;
}
for(int i = 0; i < N; i++){
int cnt = 0;
cin >> name >> m;
for(int j = 0; j < m; j++){
cin >> num;
if(thing[num] == 1){
if(cnt == 0){
cout << name << ":";
cntpeo++;
cnt++;
}
cntth++;
printf(" %04d", num);
}
}if(cnt != 0){
cout << endl;
}
}
cout << cntpeo << " " << cntth;
}