The impact of a large body with the Earth may have been the punctuation mark at the end of a progressive decline in biodiversity during the Maastrichtian Age of the Cretaceous Period. The result was the extinction of three-quarters of Earth's plant and animal species. The impact created the sharp break known as K–Pg boundary (formerly known as the K–T boundary). Earth's biodiversity required substantial time to recover from this event, despite the probable existence of an abundance of vacant ecological niches.
Despite the severity of K-Pg extinction event, there was significant variability in the rate of extinction between and within different clades. Species which depended on photosynthesis declined or became extinct as atmospheric particles blocked solar energy. As is the case today, photosynthesizing organisms, such as phytoplankton and land plants, formed the primary part of the food chain in the late Cretaceous, and all else that depended on them suffered as well. Herbivorous animals, which depended on plants and plankton as their food, died out as their food sources became scarce; consequently, the top predators such as Tyrannosaurus rex also perished. Yet only three major groups of tetrapods disappeared completely; the non-avian dinosaurs, the plesiosaurs and the pterosaurs. The other Cretaceous groups that did not survive into the Cenozoic era, the ichthyosaurs and last remaining temnospondyls and non-mammalian cynodonts were already extinct millions of years before the event occurred.
Coccolithophorids and molluscs, including ammonites, rudists, freshwater snails and mussels, as well as organisms whose food chain included these shell builders, became extinct or suffered heavy losses. For example, it is thought that ammonites were the principal food of mosasaurs, a group of giant marine reptiles that became extinct at the boundary.
Omnivores, insectivores and carrion-eaters survived the extinction event, perhaps because of the increased availability of their food sources. At the end of the Cretaceous there seem to have been no purely herbivorous or carnivorous mammals. Mammals and birds which survived the extinction fed on insects, larvae, worms and snails, which in turn fed on dead plant and animal matter. Scientists theorise that these organisms survived the collapse of plant-based food chains because they fed on detritus.
In stream communities, few groups of animals became extinct. Stream communities rely less on food from living plants and more on detritus that washes in from land. This particular ecological niche buffered them from extinction. Similar, but more complex patterns have been found in the oceans. Extinction was more severe among animals living in the water column, than among animals living on or in the sea floor. Animals in the water column are almost entirely dependent on primary production from living phytoplankton, while animals living on or in the ocean floor feed on detritus or can switch to detritus feeding.
The largest air-breathing survivors of the event, crocodilians and champsosaurs, were semi-aquatic and had access to detritus. Modern crocodilians can live as scavengers and can survive for months without food and go into hibernation when conditions are unfavourable, and their young are small, grow slowly, and feed largely on invertebrates and dead organisms or fragments of organisms for their first few years. These characteristics have been linked to crocodilian survival at the end of the Cretaceous.
Explanation from: https://en.wikipedia.org/wiki/Dinosaur#Extinction_of_major_groups