diff options
| author | Thomas Schmucker <ts@its1.de> | 2024-12-15 22:32:42 +0100 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2024-12-15 22:32:42 +0100 |
| commit | 593e2531315e66a3add1644fe838286fbea478b8 (patch) | |
| tree | 4a008838b59333255b72bd0e41bf3c11330ea539 /2024/src/day09.cpp | |
| parent | e733679389d4facd44055dc7844a0441c5bee02e (diff) | |
| download | advent-of-code-593e2531315e66a3add1644fe838286fbea478b8.tar.gz advent-of-code-593e2531315e66a3add1644fe838286fbea478b8.tar.bz2 advent-of-code-593e2531315e66a3add1644fe838286fbea478b8.zip | |
cleanup
Diffstat (limited to '2024/src/day09.cpp')
| -rw-r--r-- | 2024/src/day09.cpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/2024/src/day09.cpp b/2024/src/day09.cpp index 7787c5c..55281e0 100644 --- a/2024/src/day09.cpp +++ b/2024/src/day09.cpp | |||
| @@ -106,28 +106,6 @@ part2(const vector<int>& data) | |||
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | /* | ||
| 110 | for ( auto& file: std::ranges::reverse_view(files) ) { | ||
| 111 | auto space = ranges::find_if(spaces, [&](const auto& space) -> bool { | ||
| 112 | return get<1>(space) >= get<2>(file) && get<0>(space) < get<1>(file); | ||
| 113 | }); | ||
| 114 | if ( space != spaces.end() ) { | ||
| 115 | // update pos | ||
| 116 | get<1>(file) = get<0>(*space); | ||
| 117 | |||
| 118 | // update space len | ||
| 119 | get<1>(*space) -= get<2>(file); | ||
| 120 | |||
| 121 | // update space pos | ||
| 122 | get<0>(*space) += get<2>(file); | ||
| 123 | |||
| 124 | if ( get<1>(*space) == 0 ) { | ||
| 125 | spaces.erase(space); | ||
| 126 | } | ||
| 127 | } | ||
| 128 | } | ||
| 129 | */ | ||
| 130 | |||
| 131 | long sum = 0; | 109 | long sum = 0; |
| 132 | for ( const auto& [fid, pos, size]: files ) { | 110 | for ( const auto& [fid, pos, size]: files ) { |
| 133 | for ( size_t x = pos; x != pos + size; ++x ) { | 111 | for ( size_t x = pos; x != pos + size; ++x ) { |
