Let the market price for the good be $P$.
It is easy to see that a consumer from group $1$'s demand for the good is $$ X_1 = \frac{100-P}{10} $$
Similarly, a consumer from group $2$'s demand for the good is $$ X_2 = \frac{50-P}{10} $$
Total demand $Q$ is then given by $$ Q = 40X_1 + 60X_2 = 700-10P $$
This means that the market inverse demand curve (i.e. aggregate demand) is $$ P(Q) = 70 - \frac{Q}{10}$$
Suppose a single monopolist were serving this market. The monopolist's profit is $$ \Pi(Q) =P(Q) \cdot Q -MC \cdot Q $$
If we take the first-order condition (i.e. take the first derivative of $\Pi$ and set it equal to $0$), we know that the optimal quantity sold satisfies $$ 70 - \frac{Q^*}{5} = 10 $$
This means that $Q^* = 300$. We can plug this back into the market demand function to find that $P^* = 40$, which is the optimal uniform price.