diff options
author | kdx <kikoodx@paranoici.org> | 2023-12-09 22:54:46 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-12-09 22:54:46 +0100 |
commit | fbdb6b2e99b25b900add6f47e22b921a923d059c (patch) | |
tree | 15f0c59c7997da4938936ab46fc2de06b5052db1 | |
parent | 609d3993c0e94c22ba7b6af956d22147c1c5522c (diff) | |
download | aoc23-fbdb6b2e99b25b900add6f47e22b921a923d059c.tar.gz |
09
-rw-r--r-- | 09/main.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/09/main.cpp b/09/main.cpp index a83b55d..9e959f3 100644 --- a/09/main.cpp +++ b/09/main.cpp @@ -25,12 +25,12 @@ int main() { } } - history.back().push_back(0); + history.back().insert(history.back().begin(), 0); long last_v = 0; for (auto i = 1u; i < history.size(); i++) { auto k = history.size() - 1 - i; - last_v = history[k].back() + history[k + 1].back(); - history[k].push_back(last_v); + last_v = history[k][0] - history[k + 1][0]; + history[k].insert(history[k].begin(), last_v); } sum += last_v; |