From 0a65e0435410b7454464a54eef4e0d8cf4e7d489 Mon Sep 17 00:00:00 2001 From: Gnarwhal Date: Tue, 1 Dec 2020 07:11:29 -0800 Subject: [PATCH] In a weary stupor my code grew wrought with linear searching a sorted list and has been dealt with accordingly :vomit: --- 2020/day1 | Bin 0 -> 37264 bytes 2020/day1.cpp | 12 ++++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100755 2020/day1 diff --git a/2020/day1 b/2020/day1 new file mode 100755 index 0000000000000000000000000000000000000000..4cdc619f1dbbea62b2b8f13313ed046768f7c928 GIT binary patch literal 37264 zcmdsgdtg-6@&C;OMG7G*Dx#JZQNc${LV!e36UgF50;EZ>w2GHJ7FbQPX|mzrR}>qt zZbLLGDq8hNTYul8wTjkOYJG&qk6_grT5F?HjTZfG1Z#Y!Rmt}=bLQN8_wHSa*!GX# zRWf^K=FFKhXU?2CXYby7t-o|;YD$WsuQcNVgGviC6{b)KnLm^d0EI@raRmN;(>TdE z4CQpjDSDv-psH&?L~A%y@M(ZlFF#cw-0(!<(@<+jaEQ>nz{j%`Rzt(^F@oxmuAQY^ z1oZI-4d;_WxYmfa^q04RyV5p&sdZu$K(4Q7-KzvrD10r=cE)bLv9XQ}WKKt3A6e)X=j0?B)4W z&YqH&)f~>s<$jZV;=O3jJXVRsh$)yp3T46({gv-O({sweRXfi8dGD@I7v6f@+}@Ke zC*E=Rr^n4OGWj#%=sITo@EPip_uoe${3s97ZV2?k--!mj@DC*6-e@JNzk$oSjMJ+?j;GJ&FA0B>Hbmg1^lFA4s-B=WN$|48F_ zqp(a#%LE@^n9t3T+L|-Zq&YmrFwMpF;RdrgQq>eOO~WjyoNd+yn}Ul&&5>YJN18$n zi@oYsRFRMwIV__hk{4{Kt@GmZm!s`TN?I7=f>re;m1bqO>93fA-lO?QPM&DGNa$Yb zq9t^VWSJ%5W^-<1u%SL&3mcIo^0XyF4NI%)LbYa9)8dx;U_(T#Q4z_98B8=2%qwXK zMT(W$s_SJl%PYbark_RSz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MGxwMAz59 zo7GVNo?N%D>+Alnmip60p#FWWhJ_-S>eH>1?)oZk-=-MDRBx)$PUn(O0lCI7x zih{F#r_|T5!)0*!c?9l-R@XXLef_&$4Yj_)Zt1V__qggW6u}ynPtY|L)a`2QPhIu( z?}RlxLNf|<_y2yWug6dSj!i?k9o3TJuK$Rue!tw8t06sm)p@z=KjW&ef1j*j=16C4 zd;B%_Syz4iJ7x_p(~JV$?Y{;*4Y^iR|NgYIR8?@>TaTND{{uEsQP & list) -> void { auto find_2020_x3(const std::vector & list) -> void { for (auto n0 = 0; n0 < list.size() - 2; ++n0) { for (auto n1 = 1; n1 < list.size() - 1; ++n1) { - for (auto n2 = 2; n2 < list.size(); ++n2) { - if (list[n0] + list[n1] + list[n2] == 2020) { + auto low = n0 + 1; + auto high = n1; + auto n2 = (low + high) / 2; + while (low < high - 1) { + auto sum = 0; + if ((sum = list[n0] + list[n1] + list[n2]) == 2020) { std::cout << (list[n0] * list[n1] * list[n2]) << std::endl; return; + } else if (sum > 2020) { + low = n2 + 1; + } else { + high = n2; } } }