I suppose you could say that, but you didn't need to know the density of mercury nor the value of g, just that pressure is proportional to height and that, therefore, we often specify pressures simply in terms of height of a specific well known liquid.
I see this as an exercise in understanding manometers, not in understanding or using P = ρgh. That equation may be used to develop the theory of manometers, but the general principle that you arrive at, is simply that the difference in pressure is proportional to the difference in height. You can, but don't need to, go back to first principles for each question, but IMO that obscures the simple relationship here.
If OP is still around and wants to proceed in the way he suggests, all he needs to do is to calculate P for each given value of x. That eliminates two options.
Then calculate P from each given value of y . That eliminates two options.
Only one option is left that can produce the correct P from both values.
So I would draw the table with two extra columns:
x ; Px ; y ; Py ; Given value of P
Where Px or Py means the pressure calculated from the given value of x or y.