diff options
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 ) { |
