-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVOTERS.cpp
More file actions
50 lines (46 loc) · 808 Bytes
/
VOTERS.cpp
File metadata and controls
50 lines (46 loc) · 808 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input.txt", "r", stdin);
// for writing output to output.txt
freopen("output.txt", "w", stdout);
#endif
int n1,n2,n3;
cin>>n1>>n2>>n3;
map<int,int> voter;
for(int i=0;i<n1;i++){
int x;
cin>>x;
voter[x]+=1;
}
for(int i=0;i<n2;i++){
int x;
cin>>x;
voter[x]+=1;
}
for(int i=0;i<n3;i++){
int x;
cin>>x;
voter[x]+=1;
}
int count=0;
vector <int> finalList;
for(auto i:voter){
if(i.second>=2){
count+=1;
finalList.push_back(i.first);
}
}
sort(finalList.begin(),finalList.end());
cout<<count<<endl;
for ( auto i: finalList){
cout<<i<<endl;
}
return 0;
}