codechef VOTERS - "discrepancies in the voters list" solution: http://ideone.com/Y5Wz76
#include <iostream>
using namespace std;
int main() {
// your code goes here
long long n1, n2, n3, arr[1000000], k, count=0, n;
cin>>n1>>n2>>n3; n=n1+n2+n3;
for(int i=0; i<1000000; i++) arr[i]=0;
while(n--) {cin>>k; arr[k]++;}
for(int i=0; i<1000000; i++) if(arr[i]>1) count++;
cout<<count<<endl;
for(int i=0; i<1000000; i++) if(arr[i]>1) cout<<i<<endl;
return 0;
}
codechef VOTERS - "discrepancies in the voters list" guidance:
assume the every ID in the list ranges 0<ID<1000000. and also dont forget that not 0<ID<50000, it is 0<n1<50000, 0<n2<50000 and 0<n3<50000. imho, that is all
This comment has been removed by the author.
ReplyDeletehow did u assume tht ID ll be with in the range of 0 to 1000000???
ReplyDeleteN1 is the number of voters in the first list, N2 is the number of voters in the second list and N3 is the number of voters in the third list.
DeleteSo those numbers are quantity not value. ID is the value. That is why.
Please dont hesitate to ask further questions, I will try to help, Thanks.