http://www.codechef.com/problems/VOTERS
Here is my solution
Dont know y i m getting Runtime error..plz check..
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
int a,b,c,x[50001],i;
int s[100001],count;
s[100001]=0;
count=0;
//freopen("fun.txt","r",stdin);
scanf("%d%d%d",&a,&b,&c);
for(i=0;i<a;i++)
{
scanf("%d",&x[i]);
s[x[i]]++;
}
for(i=0;i<b;i++)
{
scanf("%d",&x[i]);
s[x[i]]++;
}
for(i=0;i<c;i++)
{
scanf("%d",&x[i]);
s[x[i]]++;
}
for(i=0;i<100000;i++)
{
if(s[i]>1)
count++;
}
printf("%d\n",count);
for(i=0;i<100000;i++)
{
if(s[i]>1)
printf("%d\n",i);
}
return 0;
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.