simplify
This commit is contained in:
parent
d66b3d3561
commit
829c9aafce
|
@ -72,11 +72,10 @@ auto Part1(std::vector<std::size_t> const& wins) -> std::uint64_t
|
|||
|
||||
auto Part2(std::vector<std::size_t> const& wins) -> std::size_t
|
||||
{
|
||||
std::vector<std::size_t> psums(wins);
|
||||
psums.push_back(0);
|
||||
std::vector<std::size_t> psums(wins.size() + 1);
|
||||
for (std::size_t i = wins.size(); i --> 0;)
|
||||
{
|
||||
psums[i] = 1 + 2 * psums[i+1] - psums[1 + i + psums[i]];
|
||||
psums[i] = 1 + 2 * psums[i + 1] - psums[i + 1 + wins[i]];
|
||||
}
|
||||
return psums.front();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user