X : Why do you look sad?

Y : I got 5 for my English test.
X : ....
Answer :
You should have studied well

The sentence states that X gave advice to Y.

Should + have + V3

it means that it was not done in the past.