A Hero Named Magnus
Time limit1sMemory limit1024 MB
Given the game x where Team LGD starts banning Magnus, find the minimum odd best-of-n series length that lets LGD win the championship in the worst case.
- Level
Medium7 of 10
- Topics
- Math, Probability
- Solved
- No attempts yet
Statement
Dota 2 is a multiplayer online battle arena (MOBA) video game developed and published by Valve. Dota 2 is played in matches between two teams of five players, with each team occupying and defending their own separate base on the map. Each of the ten players independently controls a powerful character, known as a 'hero', who all have unique abilities and differing styles of play. During a match, players collect experience points and items for their heroes to defeat the opposing team's heroes in player versus player combat. A team wins by being the first to destroy the other team's 'Ancient', a large structure located within their base.
The International is an annual esports world championship tournament for the video game Dota 2, hosted and produced by the game's developer, Valve. The tournament consists of teams: 12 based on final results from the Dota Pro Circuit and six more from winning regional playoffs in the North America, South America, Southeast Asia, China, Eastern Europe, and Western Europe regions.
In Year 3021, The International is held in Guilin, China. Once again, just like years ago, Team LGD from China will compete against Team Spirit from Russia. As the championship develops, the rule is that whoever wins the best of games wins the championship, where is an odd positive integer. So a team must win at least games. In 2021, was only , and Team Spirit won .
Before the game starts, teams can choose to ban specific heroes from being used by the opponent team. Over these years, everyone has known that Team Spirit is very good at using a hero called Magnus, which once helped them defeat Team LGD in .

Everyone thinks Team LGD will choose to ban Magnus from the beginning, but Team LGD thinks differently. They believe they are strong enough to beat the opponent's Magnus, so they will only start to ban Magnus in the -th game, and only if there is an -th game.
To simplify the problem, if Team LGD chooses to ban Magnus, they will certainly win that game. Otherwise, they have a chance to win the game.
JB, a fan of Team LGD, wants to know the minimum number of with which Team LGD can win the championship in the worst case.
Input
The first line contains an integer (), the number of test cases.
Each of the next lines contains an integer (), indicating that Team LGD will start to ban Magnus in the -th game.
Output
For each test case, output an integer on one line, the minimum total number of games needed for Team LGD to win.
Hint
Ignoring everyone's strongest wish, there exists in the test data, which means Team LGD will not always choose to ban Magnus from the beginning.