I was playing a ranked game in League of Legends and 3 out of my 4 allies were trolling. For example the ACD came mid and was just standing there taking up XP but not doing anything. One of the worst parts was that our team would not surrender and the other team would not end the game, meaning they were just killing us over and over so I was stuck in an endless game. So I was wondering if there was a way I could leave and not be punished, as leaving a ranked game has consequences.
There is currently no way to completely avoid the penalties associated with leaving a ranked game early, regardless of the circumstances surrounding it. An unfortunate part of the LeaverBuster system is that it isn't very robust at accounting for players that leave as a result of trolls on their team.
If your goal is to be able to play another game rather quickly, one thing you could do is just "open mid," which means you expressly do not defend the middle lane on the map and allow the enemy team to push without resistance. You can announce that you/your team are going to do so in all chat if you feel like it, which should make it so the enemy team knows to group up in the mid lane and push to win. While you wait for the enemy team to end the game, make sure to keep your champion active to avoid imposing an AFK penalty. You can do this simply by moving or casting a spell every so often.
In North America, there's more negative stigma around opening mid, whereas in other regions like China and South Korea, it's a much more commonly accepted practice in games that have a high amount of trolls or are far too difficult to win. You are justified in doing so in this case considering just how many players on your team aren't trying to win.
Alternatively, if you haven't recently imposed a LeaverBuster penalty, you can just leave. As I detailed in an answer here, the first tier of the LeaverBuster penalty is just a warning. You do, of course, still lose LP, but with a team full of trolls, that was going to happen anyway.