Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- for ($mem = array_map('intval', explode("\t", trim(file_get_contents('input.txt')))), $hist = []; count($hist) == count(array_unique($hist)); $hist[] = implode("-", $mem)) {
- for ($mem[$i = array_search($blocks = max($mem), $mem)] = 0; $blocks > 0; $blocks--) {
- $mem[(++$i) % count($mem)]++;
- }
- }
- echo "Part One: " . count($hist) . PHP_EOL . "Part Two: " . (count($hist) - 1 - array_search($hist[count($hist) - 1], $hist)) . PHP_EOL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement