>>43331102One *could* do it that way, but the creatures are numerated as having an XP value, even in 4e/5e.
So the challenge rating is just the sum of the creatures, and depending on DM, you'll either have to kill or "defeat" (could mean "flee") each individual to tally it up. In other words, it hinges on how the DM defines "defeating" enemies, but you can see how a DM would make the enemies incredibly hostile so all would have to die, or perhaps they truly believe defeat=murder.