forked from pranavanurag/SPOJSolutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFACEFRND.cpp
More file actions
35 lines (27 loc) · 651 Bytes
/
Copy pathFACEFRND.cpp
File metadata and controls
35 lines (27 loc) · 651 Bytes
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
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
int N, temp;
cin>>N;
vector<int> Friends, Temp, FoF;
for (int i = 1; i <= N && cin>>temp; i++)
{
Friends.push_back(temp);
int n1;
cin>>n1;
for (int j = 1; j <= n1 && cin>>temp; j++)
Temp.push_back(temp);
}
sort(Friends.begin(), Friends.end());
sort(Temp.begin(), Temp.end());
Temp.erase(unique(Temp.begin(), Temp.end()), Temp.end());
for (int i = 0; i < Temp.size(); i++)
if (!binary_search(Friends.begin(), Friends.end(), Temp[i]))
FoF.push_back(Temp[i]);
cout<<FoF.size()<<endl;
return 0;
}