Regardless of how a person's remains are buried (or not buried), they will be judged and given their punishment or reward. For example, the man in this hadith:
The Prophet (ﷺ) said, "There was a man amongst the people who had suspicion as to the righteousness of his deeds. Therefore he said to his family, 'If I die, take me and burn my corpse and throw my ashes into the sea on a hot (or windy) day.' They did so, but Allah, collected his particles and asked (him), What made you do what you did?' He replied, 'The only thing that made me do it, was that I was afraid of You.' So Allah forgave him." (Sahih Bukhari)
So, whatever happens to a person's corpse, Allah will gather it back together:
Does man think that We shall not put together his bones? No but indeed, We are able to proportion [even] his fingertips! (75:3-4)
Does man suppose that he would be left alone [after death] to futility? Was he not [once] a drop of emitted semen? Then he became a clinging mass; then He created [him] and proportioned [him], and made of him the two sexes, the male and the female. Is not such a one able to revive the dead? (75:36-40)
Basically, Allah can and will revive all the dead to be judged. The punishment of the grave is harder to say about, and I don't think we can find (and nor do we need) a definitive answer about it. But, the Day of Judgement we know is guaranteed for everyone.