11678 - Cards' Exchange
Solution Description : Ad hoc set intersection problem Example: 10 9 1 1 2 3 5 7 8 8 9 15 - set x 2 2 2 3 4 6 10 11 11 - set y Distinct value in x - 1 2 3 5 7 8 9 15 , Set A=8 Number of distinct value in x. Distinct value in y - 2 3 4 6 10 11 , Set B=6 Number of distinct value in y. for each distinct value of y (Because y contain less number of distinct value) ----- if the value is not the value of x then count++ print count For all above operation you can you two bool array X[100001] and Y[100001] |
||||||||||