Extremal Subgraphs of Random Graphs: an Extended Version