You have not taken care of the test case where the number is repeated more 
than once in a single list and is not there in other lists.

Problem desc - "the final list including only those ID numbers that 
appeared in at least 2 out of the 3 lists"

so it should not display the numbers which appear more than once in a 
single list and are not there in other lists.

Thanks...

On Friday, 13 April 2012 10:01:12 UTC+5:30, rishbhjain wrote:
>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/8x94LJfb1EgJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to